I recently updated my robotic lawn mower site running an old version of MediaWiki to the current (as of this writing) version 1.17.0. The wiki had been filled with a bunch of spam users so after cleaning that up I thought I would add in the trusty Bad Behavior extension to keep some of the bad guys away. Long story short: it didn’t work and despite much Googling I couldn’t find a current solution.
So for my own future reference and to help anyone else dealing with this, here is how I made it go.
- Grab the latest development version of Bad Behavior. Development has been stuck at version 2.1.13 due to a lack of donations so consider donating to the project if this is important to you. I donated a while back but it’s probably time for another one.
- Unpack the zip file and put the whole bad-behavior folder in your MediaWiki extensions directory.
- This version of Bad Behavior looks for a settings.ini file in its main directory to override settings. If the file is not there you will get array errors. So even if you don’t need to override settings at least create an empty file with that name.
- Bad Behavior requires a DatabaseFunctions.php file for some database compatibility functions. This outdated file is no longer included in MediaWiki 1.17.0. Download MediaWiki 1.16.5, which is the last version to include that file. Grab the DatabaseFunctions.php from the includes directory and put it in your current MediaWiki install’s includes directory.
- Now ignore the Bad Behavior instructions and put this in your MediaWiki LocalSettings.php file:
include_once( "$IP/includes/DatabaseFunctions.php" );
include( "$IP/extensions/bad-behavior/bad-behavior-mediawiki.php" );
That should do it.