Imperfect Storm: Bad Behavior, Dreamhost, PHP5, and MediaWiki
(Updated below.)
I run several wikis under my Dreamhost account. About a year ago, I was getting absolutely crushed under the weight of spambots. After one particularly bad attack that took about 3 hours to clean up, I discovered Bad Behavior. Bad Behavior is a spam-fighting extension for MediaWiki, WordPress, Drupal, Geeklog, and DotClear. I haven’t tried it on the other platforms, but for my MediaWiki sites, it’s been a real godsend. I just unzipped the file into my extensions directory, added a short line of code to the end of LocalSettings.php, and sat back and did nothing! My spam problem was gone.
A couple of nights ago, I upgraded one of my wiki sites to the latest version of MediaWiki, and immediately encountered a “Call to undefined function” error with Bad Behavior. I updated BB to the latest version, but to no avail. The site would work with the extension disabled, but that’s no way to run a wiki. The problem, apparently, lies in a sort of perfect storm of the particular versions of MediaWiki (1.9.2), Bad Behavior (2.0.10), and PHP (5.1.2). Dreamhost hasn’t yet updated to PHP 5.2. If they had (or if I wanted to tackle that job myself), this likely wouldn’t be an issue.
Fortunately, however, there is a pretty easy solution. Thanks to commenter Brian Hartvigsen on the Bad Behavior blog, I found that the answer was to add the following line to LocalSettings.php:
require_once( "includes/DatabaseFunctions.php" );
This goes at the top your LocalSettings file, just below require_once( "includes/DefaultSettings.php" );. Here’s a picture, so you can see what I mean:

Note that this does apparently cause some formatting problems with the edit page of the wiki, but I decided that I could live with the minor glitches; I couldn’t live with the spam.
Hope that helps anyone else who’s having this issue.
UPDATE 2-21-07: Dreamhost is now upgrading to PHP 5.2.1, so this will likely cease to be an issue. So, something else will probably break. Guess I know what I’m doing this evening…













Thanks, Eastwood. Glad you found this useful.
Bad Behavior has been working great for me, but it does occasionally seem to get overwhelmed and let a bunch of spammy edits through… or maybe the spammers just try some new tricks. Anyway, there seem to be waves of spam followed by long periods of normalcy. That’s much better than running unprotected, though.
Hey! Your Bad Behavior fix is really helpful. thanks a lot!