Thread: vBMicrostats
View Single Post
  #29  
Old 05-19-2006, 05:09 AM
DementedMindz DementedMindz is offline
 
Join Date: Jan 2006
Posts: 1,474
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok quick question here is what i have so far...

Code:
if ($vbulletin->options['vb_mstats_active'])
{
	$colspan = 1;
	if ($show['quickchooser'])
	{
		$colspan++;
	}
	if ($show['languagechooser'])
	{
		$colspan++;
	}

	$page_endtime = microtime();
	$start_time = explode(' ', $pagestarttime);
	$end_time = explode(' ', $page_endtime);
	$total_time = vb_number_format($end_time[0] - $start_time[0] + $end_time[1] - $start_time[1], $vbulletin->options['vb_mstats_decimal']);

	$query_time = $vbulletin->db->mstime_total;
	$query_count = $vbulletin->db->querycount;

	$php_percent = vb_number_format(((($total_time - $query_time) / $total_time) * 100), 2) . '% PHP';
	$sql_percent = vb_number_format((($query_time / $total_time) * 100), 2) . '% MySQL';

	$ms_output .= '		<span class="smallfont">Page generated in ' . $total_time . ' seconds (' . $php_percent . ' - ' . $sql_percent . ') with ' . $query_count . ' queries</span>' . "\n";

	if ($vbulletin->options['vb_mstats_adminactive'] AND $vbulletin->userinfo['usergroupid'] == 6)
	{
		$memory_status = '';
		if ($vbulletin->options['vb_mstats_memory'])
		{
			if (!function_exists('memory_get_usage'))
			{
				function memory_get_usage()
				{
					$mem_output = array();
					if (strtolower(substr(PHP_OS, 0, 3)) == 'win')
					{
						exec('tasklist /FI "PID eq ' . getmypid() . '" /FO LIST', $mem_output);
						return preg_replace( '/[^0-9]/', '', $output[5] ) * 1024;
					}
					else
					{
						$pid = getmypid();
						exec("ps -eo%mem,rss,pid | grep $pid", $mem_output);
						$mem_output = explode(' ', $mem_output[0]);
						return $mem_output[1] * 1024;
					}
				}
			}
			$memory_status = vb_number_format((memory_get_usage() / 1024), 2) . 'KB Used | ';
		}

		$debug_status = '';
		if ($vbulletin->options['vb_mstats_debug'])
		{
			$debug_status = 'DEBUG Mode OFF | ';
			if ($vbulletin->debug)
			{
				$debug_status = 'DEBUG Mode ON | ';
			}
		}

		$gzip_status = '';
		if ($vbulletin->options['vb_mstats_gzip'])
		{
			$gzip_status = 'GZIP OFF | ';
			if ($vbulletin->options['gzipoutput'] AND !$vbulletin->nozip)
			{
				$gzip_status = 'GZIP ON (level ' . $vbulletin->options['gziplevel'] . ') | ';
			}
		}

		$server_status = '';
		if ($vbulletin->options['vb_mstats_server'])
		{
			if ($stats = @exec('uptime 2>&1') AND trim($stats) != '' AND preg_match("#: ([\d.,]+),?\s+([\d.,]+),?\s+([\d.,]+)$#", $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);
				$server_status = '<strong>' . $regs[1] . '</strong> : ' . $regs[2] . ' : ' . $regs[3] . ' | ';
			}
		}

		$templates_status = '';
		if ($vbulletin->options['vb_mstats_templates'])
		{
			$templates_status = 'NO Uncached Templates';
			if ($_TEMPLATEQUERIES)
			{
				$templates_status  = '<select class="smallfont" size="1">' . "\n";
				$templates_status .= '<optgroup label="Uncached Templates: ' . sizeof($_TEMPLATEQUERIES) . '">' . "\n";
				if (is_array($tempusagecache))
				{
					global $vbcollapse;
	
					ksort($tempusagecache);
					foreach ($tempusagecache AS $tempname => $times)
					{
						if ($_TEMPLATEQUERIES["$tempname"])
						{
							$templates_status .= '<option class="alt2" selected="selected">' . $tempname . ' (' . $times . ')</option>' . "\n";
						}
						else
						{
							$templates_status .= '<option>' . $tempname . ' (' . $times . ')</option>' . "\n";
						}
					}
				}
				$templates_status .= '</optgroup>' . "\n";
				$templates_status .= '</select>';
			}
		}
		$ms_output .= '<tr align="' . $stylevar['right'] . '">' . "\n";
		$ms_output .= '	<td class="alt1"' . iif($show['quickchooser'] OR $show['languagechooser'], ' colspan="' . $colspan . '"') . '>' . "\n";
		$ms_output .= '		<span class="smallfont">' . $memory_status . $debug_status . $gzip_status . $server_status . $templates_status . '</span>' . "\n";
		$ms_output .= '	</td>' . "\n";
		$ms_output .= '</tr>' . "\n";
	}

	$output = str_replace('{microstats}', $ms_output, $output);
}

ok now when i remove the bottom table it all groups in one line... im tryin to keep it 2 lines like you have it but when i remove the admins alt1
Code:
	$ms_output .= '	<td class="alt1"' . iif($show['quickchooser'] OR $show['languagechooser'], ' colspan="' . $colspan . '"') . '>' . "\n";
thats when it all groups where should i add a break?
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01227 seconds
  • Memory Usage 1,791KB
  • 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
  • (2)bbcode_code
  • (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