Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons

Reply
 
Thread Tools
vBMicroStats Details »»
vBMicroStats
Version: 1.1.0, by TECK TECK is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Category: Board Optimization - Version: 3.6.5 Rating:
Released: 02-24-2007 Last Update: 03-02-2007 Installs: 280
Uses Plugins Template Edits
Code Changes  
No support by the author.

This hack will add at the bottom of each vBulletin (powered) page, the statistics listed below.
Also, it will help you troubleshoot and optimize your vBulletin board by viewing or comparing PHP/MySQL options and other statistics that are normally hidden in your forum pages.

Regular Users:
? Load time of specified page in microseconds
? Number of queries executed
? PHP percent page usage
? MySQL percent page usage

Administrators Only:
? Active users browsing the forum (members and guests) new in 1.1.0
? Server memory usage per page (in Kb)
? Display DEBUG mode status
? Browser GZIP library compression status
? Server average loads
? Uncached templates (useful to troubleshoot the code)

The code modifications were tested into a clean installed vBulletin board. They work 100%.
The hack was tested in vBulletin 3.6.4 and 3.6.5.
If you want to test it into a lower version (3.6.x), let me know.
Also, if you encounter any problems, feel free to post your questions here.

Step by step install instructions are posted into readme.html file.
In order to perform an efficient modification of your files, I recommend you to use Komodo Edit or Textpad.
Both editors will allow you to complete all steps without any coding errors.

The code changes are very safe and designed not to interfere in any way with the vBulletin performance/functionality.
Make sure you modify, save and upload one file at the time to your server.
Then, simply run the product-vbmicrostats.xml file.

[high]The PLUGIN itself is DISABLED by default.[/high]
This was done in order to make sure you properly edit your code first and to avoid surprises.
You will need to enable it, once your code modifications are completed:
Plugins and Products > Manage Products > vB Microstats > Enable (dropdown)
Then, go to your vBulletin Options, click on BB MicroStats setting group and set all your options.

Upgrade to version 1.0.2.
Upgrade to version 1.0.3.
Upgrade to version 1.1.0.

Want to be a guinea pig and try this hack into a higher vBulletin version?
Post your results, so others can read your feedback.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 02-25-2007, 08:51 PM
ncweb ncweb is offline
 
Join Date: Feb 2007
Location: US
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I installed version 1.0.5 for 3.5.4 and made it work with 3.6.4 by using the code below.

Maybe a dumb question, but is there any reason I should use this version instead? It seems like there are more code changes and 2 new files.

Also, before I could get this post out the version changed from 1.0 to 1.0.1; what changes were made to the /plugins files? Great mod TECK, Thank you...

Quote:
Originally Posted by LunaTech View Post
Till TECK gets to this, all you have to do to get this working in 3.6.4 is change what you edit in class_core.php. Instead of the instructions given, replace execute_query in class_core.php with:

Code:
	function &execute_query($buffered = true, &$link)
	{
		$this->connection_recent =& $link;
		$this->querycount++;

		// start microstats timer
		$this->mstimer_start();
		$queryresult = $this->functions[$buffered ? 'query' : 'query_unbuffered']($this->sql, $link);
		$this->mstimer_stop();

		if ($queryresult)
		{
			// unset $sql to lower memory .. this isn't an error, so it's not needed
			$this->sql = '';

			return $queryresult;
		}
		else
		{
			$this->halt();

			// unset $sql to lower memory .. error will have already been thrown
			$this->sql = '';
		}
	}

	/**
	* vBMicroStats: Query execution time
	*
	* @return	string
	*/
	var $mstime_total = 0;
	var $mstime_before = array();
	function mstimer_start()
	{
		$this->mstime_before[] = microtime();
	}
	function mstimer_stop($qtime_total = true)
	{
		$mstime_after  = microtime();
		$mspage_start  = explode(' ', TIMESTART);
		$mspage_start  = $mspage_start[0] + $mspage_start[1];
		$mstime_before = explode(' ', array_pop($this->mstime_before));
		$mstime_before = $mstime_before[0] + $mstime_before[1] - $mspage_start;
		$mstime_after  = explode(' ', $mstime_after);
		$mstime_after  = $mstime_after[0] + $mstime_after[1] - $mspage_start;
		$mstime_taken  = $mstime_after - $mstime_before;
		if ($qtime_total)
		{
			$this->mstime_total += $mstime_taken;
		}
	}
Reply With Quote
  #13  
Old 02-25-2007, 09:55 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

One, the code edit in the above function is not accurate, the execution time will not be reflected properly.
Two, there are 2 execute_query() functions in VB, totally different. You DO NOT paste the same code in both places.

Hmm, I think I found a bug. Guys do this, logout and tell me if you still see the admin microstats.
You should only see the regular microstats, the second line should be hidden.
Reply With Quote
  #14  
Old 02-25-2007, 09:57 PM
thincom2000 thincom2000 is offline
 
Join Date: May 2006
Location: Bronx, NY
Posts: 1,205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Never thought I would say this, but now I wish I could turn on enable-memory-limit.
Reply With Quote
  #15  
Old 02-25-2007, 10:00 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Guys, make me a favor, logout and tell me if you still see the admin microstats.
Thanks.
Reply With Quote
  #16  
Old 02-25-2007, 10:55 PM
thincom2000 thincom2000 is offline
 
Join Date: May 2006
Location: Bronx, NY
Posts: 1,205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TECK View Post
Guys, make me a favor, logout and tell me if you still see the admin microstats.
Thanks.
In plugins/hook_global_complete.php, find:
PHP Code:
    $show['adminoptions'] = $vbulletin->options['vb36_mstats_adminactive'] AND $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']; 
Replace with:
PHP Code:
    $show['adminoptions'] = ($vbulletin->options['vb36_mstats_adminactive'] AND $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']) ? true false
Reply With Quote
  #17  
Old 02-25-2007, 11:08 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks. So, does it show the admin stats when logged out?
The code should be:
Code:
$show['adminoptions'] = (bool)($vbulletin->options['vb36_mstats_adminactive'] AND $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']);
Still, those are both boolean values, is like saying twice true or false.

For some servers, the data needs to be loaded directly into memory.
Can you guys post and tell me if with the actual unchanged code from version 1.0.1 you see the admin stats while logged out.

The fix is easy, but I need to make sure.
Reply With Quote
  #18  
Old 02-26-2007, 12:06 AM
ncweb ncweb is offline
 
Join Date: Feb 2007
Location: US
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In 1.0.1 yes, I do see the admin stats as guest, registered and admin user.

/installed
Reply With Quote
  #19  
Old 02-26-2007, 12:31 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Perfect, thanks.
Fixing this bug is very easy. I also decided to load into memory all data, it should improve performance.

To upgrade to version 1.0.2, all you have to do is:
1. Uninstall the vBMicrostats product but leave class_core.php and init.php code modifications in place.
They are good.

2. Delete folder /plugins.

3. Download the new 1.0.2 .zip file.

4. Run the product-vbmicrostats.xml installer.

5. Enable all BB MicroStats options, like before.

You are done.
Reply With Quote
  #20  
Old 02-26-2007, 12:39 AM
DementedMindz DementedMindz is offline
 
Join Date: Jan 2006
Posts: 1,474
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

teck will this code mod still work from this post? https://vborg.vbsupport.ru/showpost....1&postcount=34
Reply With Quote
  #21  
Old 02-26-2007, 12:40 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes.
Use the new conditionals, compare the code.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:56 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04855 seconds
  • Memory Usage 2,320KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete