vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   VB3 MicroStats (https://vborg.vbsupport.ru/showthread.php?t=62173)

r.cakir 04-02-2004 04:17 AM

No, it's a Apple Xserve running Mac OS X Server 10.3.3 operating system (Darwin 7.3.0). The microstats for vB 2.x worked perfect on the same server previously.

Gary King 04-02-2004 11:17 AM

Wow, Apple for a server? Is it a production server? :eek: Anyhow, I'm not too sure, maybe TECK could bring in some insight? :)

TECK 04-02-2004 02:26 PM

Quote:

Originally Posted by r.cakir
Installed and double checked the modifications, but still getting wrong result in PHP and MySQL percentage:

Code:

Page generated in 0,24497795 seconds (0,00% PHP - 0,00% MySQL) with 11 queries
4 Uncached Templates | DEBUG Mode OFF | GZIP ON (level 1)

I know, I made a mistake somewhere. Maybe someone can put me in the right direction.

Thanks!

r.cakir

Please turn the DEBUG Mode ON and let us know if you see the classic message: "Doing xxxx PHP and xxxx MySQL things...". If you get value 0 for both, then is definitelly the server.
The code was tested also on the final version of VB3. :)

Gary King 04-02-2004 06:56 PM

Microstats works fine for me on vB3 Gold, nice job TECK :)

Bon travaille la, eh? ;)

Boofo 04-02-2004 06:58 PM

Then how come you didn't click install? ;)

Gary King 04-02-2004 07:10 PM

Quote:

Originally Posted by Boofo
Then how come you didn't click install? ;)

Are you happy now? ;)

Boofo 04-02-2004 07:25 PM

You have no idea the joy you've just brought to me. ;)

neocorteqz 04-03-2004 08:56 PM

Works Great

Page generated in 0.19956589 seconds (90.55% PHP - 9.45% MySQL) with 13 queries on
Forum Home.

TECK 04-04-2004 10:49 PM

Version 1.2 released... check the first post for more info.

PitchouneN64ngc 04-04-2004 10:53 PM

Will update, thanks ^^

neocorteqz 04-05-2004 03:37 AM

Thanks for the update, Now i don't have any uncached templates, but if i did, how would i go about adding it to the list of cached templates?? Just asking for a push in the right direction, not the outright answer, unless it really is that simple. :)

thanks again.

Oblivion Knight 04-05-2004 05:50 AM

Thanks for the update TECK, however your instructions still say Version 1.1 ;)

djohn 04-05-2004 08:34 AM

TECK, how can I update from version 1.1?

TECK 04-05-2004 11:29 AM

The change is listed in file: FORUM/includes/functions.php (1 change more exacly).
Look at the old 1.1 file and replace the code with the new one.

Cheers.

Boofo 04-05-2004 11:44 AM

To update from v1.1 to v1.2, do the following:

In functions.php, find:

PHP Code:

        $mstemplates 'NO Uncached Templates | ';
        if (
$_TEMPLATEQUERIES)
        {
            
$mstemplates '<b>' sizeof($_TEMPLATEQUERIES) . '</b> Uncached ';
            
$mstemplates .= iif(sizeof($_TEMPLATEQUERIES) != '1''Templates''Template') . ' | ';
        } 

REPLACE it with:

PHP Code:

        $mstemplates '<select size="1" style="font-size: 10px">' "\n";
        
        if (
$_TEMPLATEQUERIES)
        {
            
$mstemplates .= '<option>' sizeof($_TEMPLATEQUERIES) . ' Uncached Template';
            
$mstemplates .= iif(sizeof($_TEMPLATEQUERIES) != '1''s') . '</option>';

            if (
is_array($tempusagecache))
            {
                global 
$vbcollapse;

                
ksort($tempusagecache);
                foreach (
$tempusagecache AS $tempname => $times)
                {
                    if (
$_TEMPLATEQUERIES["$tempname"])
                    {
                        
$mstemplates .= '<option class="alt2">' $tempname ' (' $times ')</option>';
                    }
                    else
                    {
                        
$mstemplates .= '<option>' $tempname ' (' $times ')</option>';
                    }
                }
            }
        }
        else
        {
            
$mstemplates .= '<option>NO Uncached Templates</option>';
        }
        
$mstemplates .= '</select>'

Thanks, Floren, for the update. I only posted this to help you out with all of the messages you'll get wanting to know how to update this great hack. ;)

Zelda-King 04-05-2004 03:12 PM

Using the code Boofo posted there is no space between the dropdown and the DEBUG status. Just a little thing but I think a space there would make it look better.

Boofo 04-05-2004 03:51 PM

All I did was post what was changed in the file. ;)

TECK 04-05-2004 04:06 PM

Quote:

Originally Posted by Boofo
Thanks, Floren, for the update. I only posted this to help you out with all of the messages you'll get wanting to know how to update this great hack. ;)

Bob, be aware, there are some other changes in the functions.php code beside the code you posted, like for example you need to globalize certain new variables...
Look at the global line there.
If I would be you, I would replace, in functions.php, the first block of code (first change) to make sure there is no confusion:
Code:

function print_output($vartext, $sendheader = 1)
{
        global $pagestarttime, $query_count, $querytime, $DB_site, $bbuserinfo;
        global $vbphrase, $vboptions, $stylevar, $_REQUEST, $_TEMPLATEQUERIES, $tempusagecache, $debug, $nozip, $ms;

        $pageendtime = microtime();

        // Number of decimals to show for microtime (ex 0.15227890)
        $msdecimal = '8';

        if ($vboptions['addtemplatename'])
        {
                if ($doctypepos = strpos($vartext, $stylevar['htmldoctype']))
                {
                        $comment = substr($vartext, 0, $doctypepos);
                        $vartext = substr($vartext, $doctypepos + strlen($stylevar['htmldoctype']));
                        $vartext = $stylevar['htmldoctype'] . "\n" . $comment . $vartext;
                }
        }

        $starttime = explode(' ', $pagestarttime);
        $endtime = explode(' ', $pageendtime);
        $totaltime = vb_number_format($endtime[0] - $starttime[0] + $endtime[1] - $starttime[1], $msdecimal);

        $msphp = vb_number_format(((($totaltime - $querytime) / $totaltime) * 100), 2) . '% PHP';
        $mssql = vb_number_format((($querytime / $totaltime) * 100), 2) . '% MySQL';

        $ms = '<tr align="right">' . "\n";
        $ms .= '                <td class="tcat"' . iif($vboptions['allowchangestyles'], ' colspan="2"') . '><div class="smallfont">';
        $ms .= 'Page generated in ' . $totaltime . ' seconds (' . $msphp . ' - ' . $mssql . ') with ';
        $ms .= $query_count . ' queries</div></td>' . "\n";
        $ms .= '</tr>' . "\n";

        if ($bbuserinfo['usergroupid'] == '6')
        {
                $mstemplates = '<select size="1" style="font-size: 10px">' . "\n";
               
                if ($_TEMPLATEQUERIES)
                {
                        $mstemplates .= '<option>' . sizeof($_TEMPLATEQUERIES) . ' Uncached Template';
                        $mstemplates .= iif(sizeof($_TEMPLATEQUERIES) != '1', 's') . '</option>';

                        if (is_array($tempusagecache))
                        {
                                global $vbcollapse;

                                ksort($tempusagecache);
                                foreach ($tempusagecache AS $tempname => $times)
                                {
                                        if ($_TEMPLATEQUERIES["$tempname"])
                                        {
                                                $mstemplates .= '<option class="alt2">' . $tempname . ' (' . $times . ')</option>';
                                        }
                                        else
                                        {
                                                $mstemplates .= '<option>' . $tempname . ' (' . $times . ')</option>';
                                        }
                                }
                        }
                }
                else
                {
                        $mstemplates .= '<option>NO Uncached Templates</option>';
                }
                $mstemplates .= '</select>';

                $msdebug = 'DEBUG Mode OFF | ';
                if ($debug)
                {
                        $msdebug = 'DEBUG Mode ON | ';
                }

                $msgzip = 'GZIP OFF | ';
                if ($vboptions['gzipoutput'] AND !$nozip)
                {
                        $msgzip = 'GZIP ON (level ' . $vboptions['gziplevel'] . ') | ';
                }

                $msserver = '';
                if ($stats = @exec('uptime 2>&1') AND trim($stats) != '')
                {
                        if (preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/", $stats, $regs))
                        {
                                $regs[1] = vb_number_format($regs[1], 2);
                                $regs[2] = vb_number_format($regs[2], 2);
                                $regs[3] = vb_number_format($regs[3], 2);

                                $msserver = '<b>' . $regs[1] . '</b> : ' . $regs[2] . ' : ' . $regs[3] . ' | ';
                        }
                }

                $ms .= '<tr align="right">' . "\n";
                $ms .= '                <td class="alt1"' . iif($vboptions['allowchangestyles'], ' colspan="2"') . '><div class="smallfont">';
                $ms .= $msdebug . $msgzip . $msserver . $mstemplates . '</div></td>' . "\n";
                $ms .= '</tr>' . "\n";
        }

        if (DB_QUERIES)
        {
                $ms = '';
                $vartext .= "<!-- Page generated in " . $totaltime . " seconds with $query_count queries -->";
        }
 
        // ####################################################################
        // temporary code
        global $DEVDEBUG, $_SERVER;
        if ($debug)
        {

That will fix the space issue mentioned before by other people as well globalize the templates cache, $tempusagecache.
Let me know if that makes sense. Thanks Bob.

Boofo 04-05-2004 04:12 PM

Ok, thanks. I was just trying to help. I guess I should have looked for more changes. ;)

TECK 04-05-2004 04:14 PM

Quote:

Originally Posted by Boofo
Ok, thanks. I was just trying to help... ;)

And I hope you will keep on doing this.
You helped me several times in my threads with bugs, etc. as well others. :)

Boofo 04-05-2004 04:17 PM

Thank you, sir. That's kind of you to say. I enjoy doing what I can, although it isn't much at times. ;)

Zelda-King 04-05-2004 06:54 PM

Boofo: It was a good gesture. Upgrade instructions are good.

Bad Bunny 04-05-2004 07:22 PM

Installed! Thanks! Works like a charm.

heynurse 04-06-2004 05:32 AM

Great Hack and Upgrade! Thanks Floren!

Nj?rd Eriksson 04-07-2004 05:13 PM

Quote:

Originally Posted by TECK
You need to have enabled the exec('uptime') in your server, in order to see the average server loads.
Contact your host for more details.

I have my own dedicated server. Can someone please tell me how to enable this? :)

Nj?rd Eriksson 04-08-2004 02:36 AM

SafeMode is off, by the way, but I still can't see the average server loads.

If I enter uptime via SSH2 with root I get a result. If I enter it with my website's account via SSH2 I get uptime: command not found, just in case it shouldn't be like this.

djohn 04-08-2004 11:29 AM

I have a question. How can i "cache" an "uncached" template without installing an update?

Boofo 04-08-2004 12:03 PM

Turn DEBUG on to find out what template is cached and put it in the templates section at the top of the file for the page it isn't cached on.

The easiest way is to install Teck's update for this great hack and you won't need to enable DEBUG to find out which template isn't cached. The drop down box for the Uncached templates (in the update) will show you the template that isn't cached. ;)

djohn 04-08-2004 12:27 PM

Quote:

Originally Posted by Boofo
Turn DEBUG on to find out what template is cached and put it in the templates section at the top of the file for the page it isn't cached on.

Didn't quite get that. I should turn on debug mode, and then edit it, but save without making any changes?

TECK 04-10-2004 12:46 AM

Quote:

Originally Posted by djohn
I have a question. How can i "cache" an "uncached" template without installing an update?

You need to know what templates are performing an extra query for their uncached name. You can do this with the latest version of this hack, it will take you 30 seconds to upgrade it.
Once you know the name of the uncached templates, simply add it to $globaltemplates array, present at the top of each .php file in vBulletin.

So if in your index.php file, you have 2 unchached templates, look at the top of index.php file and find:
Code:

$globaltemplates = array(
        'FORUMHOME',
        ...,

and add the end the template name you missed to add.

Cheers.

PS. Upgrade, is really easy the change. ;)

djohn 04-10-2004 11:26 AM

Right, I've updated, but I can't figure out what template is uncashed, there's a 1 next to all of them. See screenshot.

BarBeQue 04-10-2004 12:34 PM

Thanks Teck.
I just removed Erwins' stats and installed yours... much more info :D

[high]* BarBeQue clicks install[/high]

sabret00the 04-10-2004 01:09 PM

PHP Code:

    $ms .= '        <td class="tcat"' iif($vboptions['allowchangestyles'], ' colspan="2"') . '><div class="smallfont">'

still getting an error on that line

Christine 04-10-2004 01:15 PM

Quote:

Originally Posted by djohn
Right, I've updated, but I can't figure out what template is uncashed, there's a 1 next to all of them. See screenshot.

It is your board_inactive_warning -- note the blue highlighting on it.

:):

neocorteqz 04-10-2004 07:01 PM

Quote:

Originally Posted by Christine
It is your board_inactive_warning -- note the blue highlighting on it.

:):

I was just about to say that. :)

I noticed that without the update installed, only cause i had the board inactive, and when the board is active i have no uncached templates.

TECK 04-11-2004 12:33 AM

Quote:

Originally Posted by djohn
Right, I've updated, but I can't figure out what template is uncashed, there's a 1 next to all of them. See screenshot.

The number in parenthesis (1), for example, indicates how many times the template is called by the script. This is just a reference for your code. Look at the "forumhome_forumbit_levelX".. I bet you have 3 categories and 9 forums (with 2 sub-forums) displayed on your front page... and there are only 2 forums where you got replies. ;)

As Christine mentioned, the uncached template is highlighted in blue.

The "board_incative_warning" template is not cached for server performace matter, and is not something the VB devs forgot.
Let me explain the way it works with the memory server cache so you understand a little better the process.

VB software uses/creates a cache, like a sort of temp folder where is stored important information that is used several times, same like in Windows. :)
All this information is stored temporarily in the VB database (that is also sanitized on a regular basis by the VB software), so it eliminates the need to scan the tables several times for the same information resulting an increase of the server load.
For example, on the forum frontpage, if you open it for the first time, there will be far more queries performed instantly (14 instead of 8), then when you visit it for the second time, due to the cache process, all temporary information is stored in the "temp" database.

Now, why all templates are NOT cached? The VB devs created a balance between the software and server. In other words, they used this aproach:
If an information is used less then 95% of the cases, there is no need to store it in the server memory/database, because most likely is not very often used, like your "board closed" template. They prefered to trade it for a query, instead of loading it into a temp process, when you use it only once every 500 cases...

That's why you will notice some uncached templates sometimes.

I hope this information helped you to understand better the cache process. :)

TECK 04-11-2004 12:44 AM

Quote:

Originally Posted by ChuanSE
nope, see here http://puredj.net

Chuan, what portal you use?
Is extremly intense on the table scans... Holly molly...
Quote:

Page generated in 0.60059810 seconds (43.99% PHP - [high]56.01%[/high] MySQL) with 16 queries
The number of queries is ok, but the code is not very strong, IMO.
Compare it yourself with any forums page. As soon as you go over 20% MySQL, you got to ask yourself what bad code you added there to perform table scans that generate those results...

Christine 04-11-2004 01:19 AM

Teck -- So you know, the blue highlighting isn't working in Opera 7.23. It is fine in IE 6 and FireFox 0.8.

Just in case you get any questions from folks who aren't seeing which template is the issue -- it may be their browser.

:)

neocorteqz 04-11-2004 05:51 AM

Quote:

Originally Posted by TECK
Chuan, what portal you use?
Is extremly intense on the table scans... Holly molly...


The number of queries is ok, but the code is not very strong, IMO.
Compare it yourself with any forums page. As soon as you go over 20% MySQL, you got to ask yourself what bad code you added there to perform table scans that generate those results...


it looks like the vBindex portal, but he has no copywrite info at the bottom, so i dont know.

as for the vBindex portal, this is what i get on portal home,

Page generated in 6.73733711 seconds (5.21% PHP - 94.79% MySQL) with 17 queries
NO Uncached Templates | DEBUG Mode OFF | GZIP ON (level 1) | 0.31 : 0.13 : 0.09

The slow loadtime is only because of the weather block i have on the portal home.

if I remove it.

Page generated in 3.35731196 seconds (9.05% PHP - 90.95% MySQL) with 17 queries
NO Uncached Templates | DEBUG Mode OFF | GZIP ON (level 1) | 1.11 : 0.31 : 0.15

is what i get. I'm sure NTLDR's code is fine. :p but I'm no coder, so i wouldn't know. :D

djohn 04-11-2004 11:47 AM

Thank you very much TECK, that did help a great deal. You were, I do have 3 categories and 9 forums with 2 sub-forums :)

Thanks a lot again :)


All times are GMT. The time now is 04:21 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01682 seconds
  • Memory Usage 1,879KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (3)bbcode_php_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete