MediaWiki
This page contains the installation guide and usage notes for Bad Behavior on MediaWiki.
Upgrading from pre-2.0
If you are upgrading from any version prior to the 2.0 release of Bad Behavior, you need to perform the following steps before installation:
First, remove all copies of Bad Behavior 1.x and any pre-release copies of Bad Behavior 2. Then, use phpMyAdmin, the MySQL command line, or another tool to remove any *bad_behavior
or *bad_behavior_log
tables in your database.
Now you are ready to install Bad Behavior version 2.
Installation
Bad Behavior is a MediaWiki extension. It is supported on MediaWiki 1.17 or later versions, though it may still work on versions as old as 1.7.
Before uploading, create a settings.ini
file using the included settings-sample.ini
file as a template and change the configuration options to your liking in settings.ini
.
Upload both the folder and its contents to your MediaWiki extensions
directory, taking care to use ASCII mode. You should end up with a bad-behavior
folder in your extensions
folder, which contains the Bad Behavior files. Once on the server, edit your LocalSettings.php
file, and add this line at the end of the file.
require_once( "$IP/extensions/bad-behavior/bad-behavior-mediawiki.php" );
If you are upgrading from a version of Bad Behavior prior to 1.1, you may have a similar line in your index.php
file instead. This is because prior versions were not full-fledged MediaWiki extensions. Remove it from index.php
and add the above line in LocalSettings.php
.
Usage
After installation you don’t need to do anything! Bad Behavior protects your entire MediaWiki automatically.
One MediaWiki-specific setting is available for use in LocalSettings.php
:
$wgBadBehaviorTimer
(default false): When enabled, adds an HTML comment to rendered pages showing Bad Behavior’s version and run time in milliseconds.
To view the Bad Behavior log, you will need a copy of phpMyAdmin installed, or some other way to view the database. Most Web hosts include phpMyAdmin as part of the control panel. Bad Behavior stores its log in the bad_behavior
table in your MediaWiki database. Browse or search through it with phpMyAdmin, the MySQL command line, or another tool. At this time Bad Behavior does not come with a built-in log viewer. You can also try using the Bad Behavior 2 Extended extension to view log entries, though I hope to have this integrated into Bad Behavior soon.
You mention that the log entries are stored in the bad_behavior table, but does the extension create that table itself? Or do we have to manually create it.
Will the extension work without the table?
Tim, you’re referring to MediaWiki? The extension will create the database table by itself. And even if it fails to create the table, it will still continue to work, only without logging.
Using MW 1.19.0.
I’ve turned the logging = false in settings.ini.
All my MediaWiki gives me these errors frequently regardless:
[Tue Jul 31 14:52:12 2012] [error] [client 204.236.236.136] PHP Warning: Bad Behavior DBQueryError A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script\nQuery: DELETE FROM `bad_behavior` WHERE `date` < DATE_SUB('2012-07-31 14:52:12', INTERVAL 7 DAY)\nFunction: \nError: 1146 Table 'XXX.bad_behavior' doesn't exist (127.0.0.1)\n in /home/httpd/vhosts/XXX/httpdocs/extensions/bad-behavior/bad-behavior-mediawiki.php on line 84
There seems to be some kind of bug somewhere. It seems to try to log even if I tell it not to, and it appers to fail when it tries to do so.
I can provide you with more information per e-mail if that is required.
Congratulations, you’ve found a bug in Bad Behavior. This bug will be fixed in the next release.
Is it possible that the require_once above should be in double quotes? At least at my installation BB only started working after I put it in double quotes because then $IP was correctly expanded
Unless Michael’s sneakily changed it since your post, the path in require_once() above is in double quotes.