vBulletin Mods

The Official vBulletin Modifications Site

Debug Functions - trace and traceQuery
by Michael Morris
14 Jul 2008 01:30

1 Attachment(s)
Minimum PHP version: 5.0.0

This mod is simply a php file that contains a couple of functions I created while developing the PAM webframework. While tiny they are highly useful.

If you are not a developer, do not install this modification - it does absolutely nothing useful on a live board. What is worse it turns on debug mode just in case you forgot the config command to do so and you don't want debug mode to be on with a live board.

There are two functions in the PHP file. You can call them in your plugins at any point after the config.php file has been read.


Upload the file to your includes folder and add the following line to your config.php file.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

That's it. Until you actually call one of the two functions it does nothing but turn on debug mode.

Using the functions

There are two functions in this package at present and this is what they do...

void trace ( mixed, ...)

Use trace where you would use echo or print_r -- it's smart enough to determine which it needs to be. The function can be overloaded - so if you need to check the status of multiple variables just pile them in. The function sends headers if it can and sets the response type to text/plain - this makes the print_r results well formatted and easy to read. The function then calls debug_backtrace to show you what's on the stack at the point it fired and this incidentally let's you know what file and what line it exists on, so you can't accidentally forget to remove it.

void traceQuery( string )

The traceQuery function takes an sql statement at its argument. It runs the query, then halts execution and prints the time that query took to resolve along with the first row's result set and how many total rows where "raised" by the query. This function exists mainly for big board optimization.

While I'm putting this in the 3.7.2 area this mod works with all versions of vbulltin 3.6 and later.

newmasalaboard 05 Aug 2009 17:44

Thanks !!

Installed ...

sockwater 05 Aug 2009 22:08

Thanks Michael, handy little functions. I dropped 'em into init_startup on a test installation for now.

All times are GMT. The time now is 15:25.

Powered by vBulletin® Version 3.8.14
Copyright © 2021, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.