vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   vbMicroStats: page load time, queries, GZIP and PHP version (https://vborg.vbsupport.ru/showthread.php?t=35811)

TECK 06-22-2002 07:49 PM

Quote:

Originally posted by FireFly
Next time let's not click Submit a hundred times... I got about 13-15 emails for this one.
lol... i imagine your face when you saw that.. sorry chen and everyone for this. i thought it didnt send the email...

N9ne 06-22-2002 10:11 PM

Great hack Nakkid, thanks :), very useful too. I like the way it tells you how many queries are executed, it's convenient :)

bandersen 06-23-2002 03:44 PM

Hi - I upgraded to 226 and installed this beauty :) No problems...
Except I need to contact my host to show the server load I guess.

TECK 06-23-2002 03:59 PM

i spoked with tubedogg and he was kind to explain to me that not all the servers will show the server load stats.
i will mention this on the first post. :)

Xelation 06-23-2002 08:48 PM

is there a way to make it so that admins can only see the stats?

LuBi 06-23-2002 10:21 PM

Quote:

Originally posted by Nakkid
lubi.. this is related to your installation. make sure you followed all the steps properly. several people asked the same question here. :)
is alot of code to be changed. please be carefull. check your steps one by one and be SURE what files you edit. let me know if you got it working.

I looked but it was working before, then it just stopped suddenly and is always 100% php now.. :confused:

TECK 06-23-2002 10:53 PM

Quote:

Originally posted by LuBi
I looked but it was working before, then it just stopped suddenly and is always 100% php now.. :confused:
is related to the db_mysql.php mods...

TECK 06-23-2002 11:00 PM

Quote:

Originally posted by Xelation
is there a way to make it so that admins can only see the stats?
you mean the hole stats?
REPLACE:
Code:

// ###################### Start dooutput #######################
function dooutput($vartext,$sendheader=1) {

  global $pagestarttime,$query_count,$showqueries,$querytime,$DB_site,$gzipoutput,$gziplevel,$bbuserinfo,$microstats;

  $pageendtime=microtime();
  $starttime=explode(" ",$pagestarttime);
  $endtime=explode(" ",$pageendtime);

  // time format (how many digits you want to show)
  $digits=8;

  $totaltime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];
  $trimmedtime=number_format($totaltime,$digits);
  $percentphp=number_format(((($totaltime-$querytime)/$totaltime)*100),2).'% PHP';
  $percentsql=number_format((($querytime/$totaltime)*100),2).'% MySQL';

  if ($bbuserinfo['usergroupid']==6) {
    if ($debug==1) {
      $debugmode='Debug Mode <font color="{ hovercolor }">ON</font>';
    } else {
      $debugmode='Debug Mode OFF';
    }
    if ($gzipoutput==1) {
      $gziptext='GZIP <font color="{ hovercolor }">enabled</font> - level '.$gziplevel;
    } else {
      $gziptext='GZIP disabled';
    }
    $versionnum=phpversion();
    if ($stats=@exec('uptime')) {
      preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs);
      $serverload=' [Server Load: <font color="{ hovercolor }"><b>'.$regs[1].'</b></font> ? '.$regs[2].' : '.$regs[3].']';
    } else {
      $serverload='';
    }
    $adminstats='<br>['.$debugmode.'] [PHP v'.$versionnum.'] ['.$gziptext.']'.$serverload;
  } else {
    $adminstats='';
  }

  if ($showqueries) {
    $vartext .= "<!-- Page generated in $totaltime seconds with $query_count queries -->";
  } else {
    eval("\$microstats = \"".gettemplate('home_microstats')."\";");
  }

WITH:
Code:

// ###################### Start dooutput #######################
function dooutput($vartext,$sendheader=1) {

  global $pagestarttime,$query_count,$showqueries,$querytime,$DB_site,$gzipoutput,$gziplevel,$bbuserinfo,$microstats;

  $pageendtime=microtime();
  $starttime=explode(" ",$pagestarttime);
  $endtime=explode(" ",$pageendtime);

  // time format (how many digits you want to show)
  $digits=8;

  $totaltime=$endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];
  $trimmedtime=number_format($totaltime,$digits);
  $percentphp=number_format(((($totaltime-$querytime)/$totaltime)*100),2).'% PHP';
  $percentsql=number_format((($querytime/$totaltime)*100),2).'% MySQL';

  if ($debug==1) {
    $debugmode='Debug Mode <font color="{ hovercolor }">ON</font>';
  } else {
    $debugmode='Debug Mode OFF';
  }
  if ($gzipoutput==1) {
    $gziptext='GZIP <font color="{ hovercolor }">enabled</font> - level '.$gziplevel;
  } else {
    $gziptext='GZIP disabled';
  }
  $versionnum=phpversion();
  if ($stats=@exec('uptime')) {
    preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs);
    $serverload='[Server Load: <font color="{ hovercolor }"><b>'.$regs[1].'</b></font> ? '.$regs[2].' : '.$regs[3].']';
  } else {
    $serverload='';
  }

  if ($showqueries) {
    $vartext .= "<!-- Page generated in $totaltime seconds with $query_count queries -->";
  } else {
    $microstats='';
    if ($bbuserinfo['usergroupid']==6) {
      eval("\$microstats = \"".gettemplate('home_microstats')."\";");
    }
  }

Your template should look like:
Code:

Page generated in $trimmedtime seconds ($percentphp - $percentsql) with $query_count queries.<br>
[$debugmode] [PHP v$versionnum] [$gziptext] $serverload

Don't forget to remove the spaces between [high]hovercolor[/high] brackets.

LuBi 06-23-2002 11:06 PM

Quote:

Originally posted by Nakkid
is related to the db_mysql.php mods...
my db_mysql.php does not match the example you given orh ave I made the changes in your instructions..

TECK 06-23-2002 11:11 PM

that's why is not working. redownload again the vb226 from members area do the changes in your new db_mysql.php file.
let me know if you got it working. :)


All times are GMT. The time now is 03:55 PM.

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.01397 seconds
  • Memory Usage 1,750KB
  • 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
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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