If you use MediaWiki to power your wiki, you’ve probably heard of the Bad-Behavior plugin to help fight spam.
Bad Behavior is a set of PHP scripts which prevents spambots from accessing your site by analyzing their actual HTTP requests and comparing them to profiles from known spambots. It goes far beyond User-Agent and Referer, however. Bad Behavior is available for several PHP-based software packages, and also can be integrated in seconds into any PHP script.
I was all for it after I read the description as well as the functions it adds to one’s wiki. So, I did the following:
1. Downloaded it like so:
wget http://www.bad-behavior.ioerror.us/download/bad-be…
2. Unzipped it with the -a option (for ASCII mode):
unzip -a bad-behavior-2.0.10.zip
3. Copied the whole folder to /path-to-wiki/extensions
cp -R /path-to-wiki/extensions
4. Edited LocalSettings.php an added the following line at the end of the file:
include( ‘./extensions/Bad-Behavior/bad-behavior-mediawiki.php’ );
The include statement above should’ve worked where a new table would’ve been added in my MediaWiki DB, but this did not happen, and when clicking on any link, I would just get a blank page.
My HTTPD logs also showed “undefined variable” errors, so after searching for fixes, I found that the following line had to be added just below the require_once(“includes/DefaultSettings.php”) line to resolve the issues.
Apparently, you’ll need this if you’re using a certain combination of Apache-PHP-MediaWiki versions:
require_once( “includes/DatabaseFunctions.php” );
I restarted Apache and all worked fine. You can also add the Bad-Behavior 2 Extended extension if you’d like, which I did.