PDA

View Full Version : Administrative and Maintenance Tools - Enable VB Debug Mode without hacking config.php


MrEyes
05-01-2008, 10:00 PM
Summary

As just about everybody knows you can enabled vBulletin debug mode by placing the following:


$config['Misc']['debug'] = true;


into the includes/config.php file. While the information this provides is extremely useful it has IMHO two major drawbacks:


Once added debug output is visible and enabled for all users of the forum.
You have to edit files on the server to enable debug mode. Yes this doesn't take long but it is still a pain.


The following hack go some way towards solving both of these drawbacks. In summary you make a single one time edit to the config.php file, once done you can enabled/disable debug mode via URL querystring arguments.

How do I use this?

Once installed, if you want to see debug output you simple add the following to the end of the URL you are viewing:


debug=XXX


for example:


http://www.mysite.com/forum/index.php?debugmode=XXX
http://www.mysite.com/forum/forumdisplay.php?f=2&debugmode=XXX


Installation summary
Installation Time: < 1 minute
VB File Edits: 1

OK, so what do I have to do?


First download a copy of your config.php file.
Open this in your favourite text editor and scroll to the last line
Directly above the "?>" paste in the following text:


if ($_GET["debugmode"] == "XXX")
{
$config['Misc']['debug'] = true;
}


Change the XXX part to some difficult to guess value (no spaces and only alphanumeric characters). If you prefer you can also change the "debugmode" query string key to something else to give a little extra security.
Save and upload the config.php file.


Once uploaded you can now view debug output by adding the querystring arguments as described above to the URL you are viewing. No more config changes and debug info is only accessible to those who know you secret "XXX" key.

Gotchas!!

This does not work when submitting data, so for example if you enter debug mode for post reply, when you click the button and submit the fact that you were in debug mode on the submission page is not carried across, and as you cannot edit the post URL the resulting page does not display debug output.

I did attempt to rectify this by added a check value into "$_SESSION", however it would seem that VB's internal session handling does not allow this to be carried through.

So if anybody has any suggestions for this issue, feel free to post them.

Lizard King
05-02-2008, 04:21 PM
<a href="https://vborg.vbsupport.ru/showthread.php?t=176700" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=176700</a>

sockwater
07-05-2008, 06:01 AM
https://vborg.vbsupport.ru/showthread.php?t=176700

Well, these two mods are different in the approach, so I wouldn't call them dupes.

I will comment that I don't think it's prudent to open up debug mode to anyone browsing your forums by allowing anyone to turn it on via the URL.