The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Microstats - load times, server loads, queries, uncached templates Details »» | |||||||||||||||||||||||||||
Microstats - load times, server loads, queries, uncached templates
Developer Last Online: Nov 2023
This is a derivative of Erwin's microstats hack for vBulletin 3.5.0's plugin system. The main difference is that by default it shows the page generation time and query count to the public. Server loads and Uncached Queries are shown only to administrators.
I had sent this to Erwin so he could release if he wanted to but instead he told me that I had permission to release it; hence why I am releasing it. This should work with vBulletin 3.5.0 RC 1 through vBulletin 3.6.1 and later. Installation is very simple. Just import the plugin via vBulletin's "Download / Upload Plugins" page in the Plugin System in the Admin Control Panel and you're done. I'll try to correct any bugs that you find. Let me know if you like this plugin and don't forget to click the install link if you install this. Optional config.php Variables $config['Microstats']['replacementvariable'] Setting this variable will make microstats place its data before any instance of whatever you set this variable to. Be careful with this as you might see microstats in mutiple places. My suggestion is to use a unique comment in the HTML source to prevent any issues. E.g. $config['Microstats']['replacementvariable'] = '<!-- display microstats here -->'; $config['Microstats']['adminonly'] Setting this variable to anything will make microstats display itself only to administrators. E.g. $config['Microstats']['adminonly'] = true; Update History Product File: Uploaded a product file that replaced the plugin file. Version 1.2.1: Fixed a bug that broke optional config.php settings Version 1.2.0: Added OpenBSD, FreeBSD and NetBSD support; added Replacement variable setting in config.php; added Display only to Administrators Setting in config.php; fixed bug affecting Linux/Unix servers that have exec('uptime') support and not /proc/loadavg support Version 1.1.0: Added names of uncached templates, included a bugfix for people who don't have proc avaliable on their system and made the code look a little nicer as well Version 1.0.1: Bugfix for Windows users, sanitized the code to make it look nicer Version 1.0.0: Initial Release Show Your Support
|
Comments |
#392
|
|||
|
|||
just send a PM to the author ...
|
#393
|
|||
|
|||
Quote:
|
#394
|
|||
|
|||
just put the older author like 'co-author' and link the original hack in the first post ... however there isn't any disclaimer here ...
|
#395
|
|||
|
|||
if Lyne says it's ok i'll update this for vb4 and provide support the best i can.
|
#396
|
||||
|
||||
I cannot give an OK for this to be posted. The only person who can give an OK for this to be ported to vB4 is the developer and he is not even responding to PMs (I sent him one a while ago about this).
|
#397
|
|||
|
|||
as always thanks for the info, Lynne
|
#398
|
|||
|
|||
Just recode it...
|
#399
|
|||
|
|||
The new error is from THIS code:
Code:
ksort($tempusagecache); foreach ($tempusagecache AS $tempname => $times) { if ($_TEMPLATEQUERIES["$tempname"]){ $debughtml .= '<center><span class="smallfont">Uncached templates: <font color="red"><b>' . $tempname . '</b></font> (' . $times . ')</span></center>'; } } |
#400
|
|||
|
|||
FIXED!
I'm awesome... this is the new plugin... DONT JUST CUT AND PASTE THIS CODE, READ MY COMMENT BELOW FIRST! Code:
// Microstats 1.2.1 Plugin $pageendtime = microtime(); $starttime = explode(' ', TIMESTART); $endtime = explode(' ', $pageendtime); $totaltime = vb_number_format($endtime[0] - $starttime[0] + $endtime[1] - $starttime[1], 5); $debughtml = '<center><span class="smallfont">Page generated in <b>' . $totaltime . '</b> seconds with <b>' . $vbulletin->db->querycount . '</b> queries'; if ($vbulletin->userinfo['usergroupid'] == 6) { if ($loadavg = @file_get_contents("/proc/loadavg")) { $regs = explode(" ",$loadavg); $serverload = ' [Server Loads: <b>' . $regs[0] .'</b> ' . $regs[1] . ' : ' . $regs[2] . ']'; }elseif ($stats=@exec(uptime)) { preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/',$stats,$regs); $serverload = ' [Server Loads: <b>' . $regs[1] .'</b> ' . $regs[2] . ' : ' . $regs[3] . ']'; }elseif ($loadavg = @'sysctl vm.loadavg|cut -d" " -f3-5') { $regs = explode(" ",$loadavg); $serverload = ' [Server Loads: <b>' . $regs[0] .'</b> ' . $regs[1] . ' : ' . $regs[2] . ']'; } $tempusagecache = vB_Template::$template_usage; $_TEMPLATEQUERIES = vB_Template::$template_queries; $debughtml .= iif($_TEMPLATEQUERIES, ' (<b>' . sizeof($_TEMPLATEQUERIES) . '</b> queries for uncached templates)', '') . "$serverload"; ksort($tempusagecache); foreach ($tempusagecache AS $tempname => $times) { if ($_TEMPLATEQUERIES["$tempname"]){ $debughtml .= '<center><span class="smallfont">Uncached templates: <font color="red"><b>' . $tempname . '</b></font> (' . $times . ')</span></center>'; } } } $debughtml .= "</span></center>"; if (!$vbulletin->config['Microstats']['replacementvariable']) { $vbulletin->config['Microstats']['replacementvariable'] = '</body>'; } if (($vbulletin->config['Microstats']['adminonly'] and $vbulletin->userinfo['usergroupid'] == 6) or !$vbulletin->config['Microstats']['adminonly']){ $output = str_replace($vbulletin->config['Microstats']['replacementvariable'], $debughtml . $vbulletin->config['Microstats']['replacementvariable'], $output); } // Microstats 1.2.1 Plugin OKAY... right now the code above ISN'T working, vb.org is giving me errors with a single line of code when I'm trying to post it here, so let me explain what you need to do to fix it. Search for the following piece of text in the code above: Code:
@exec(uptime) A comment about copyright with code... History has shown us, that if you give two engineers the same problem and unlimited amount of time, they will both eventually come up with the same solution; especially if there is only ONE way to fix the problem. With this modification, there is really only ONE way to do it. I mean I could rewrite the code, come up with new variable names and everything... but its pretty much going to be the same exact code, even though I wrote it from scratch. If I rewrite the code, can I post it as a new mod? Even though its going to look pretty much the same? |
#401
|
|||
|
|||
Quote:
|
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|