Thread: VB3 MicroStats
View Single Post
  #98  
Old 04-05-2004, 04:06 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01270 seconds
  • Memory Usage 1,798KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete