How to install reCaptcha on your MediaWiki

Lately I just ran into heavy spamming among all my MediaWiki’s wikis.
It first began with plain anonymous spamming (I wanted to leave anonymous editing available), then I forced account creation, then spammers were automating new account registrations before updating existing pages and creating new ones with spam.

So I decided to do things properly and install the reCaptcha plugin for MediaWiki.

Apparently the problems you may encounter while doing so highly depends on your PHP and MediaWiki versions.
Here are mine:

  • PHP: 5.3.2
  • MediaWiki: 1.14.0 and 1.15.1
  1. Create a set of public/private keys using Google’s reCaptcha service.
  2. Follow instructions on Google’s help to install reCaptcha’s MediaWiki plugin. At the time of this writing, I used version 1.7.
  3. An additional step is needed to allow editing pages. Modify file extensions/recaptcha/ReCaptcha.php, by replacing the following line
    function confirmEdit( &$editPage, $newtext, $section ) {

    with this:

    function confirmEdit( $editPage, $newtext, $section ) {

    (Just remove the & character). This issue is covered in this ticket.

And here you go: up and running MediaWiki with reCaptcha. You can check one of my installations here.

About Muriel Salvan

I am a freelance project manager and polyglot developer, expert in Ruby and Rails. I created X-Aeon Solutions and rivierarb Ruby meetups. I also give trainings and conferences on technical topics. My core development principles: Plugins-oriented architectures, simple components, Open Source power, clever automation, constant technology watch, quality and optimized code. My experience includes big and small companies. I embrace agile methodologies and test driven development, without giving up on planning and risks containment methods as well. I love Open Source and became a big advocate.
Antispam, Howto, Web development , , , , ,

Leave a Reply

Your email address will not be published.