Extension:AkismetKlik

About
The AkismetKlik extension rejects edits identified as being from comment spammers. It uses Akismet, an adaptive spam-filtering service originally devised by WordPress for use by blog hosts.

Installation
This extension requires PHP5 and uses the Akismet.class library, available here.

Installation steps:
 * 1) Save Akismet.class.php to the AkismetKlik folder.
 * 2) Download the source for the AkismetKlik.php extension into the AkismetKlik folder.
 * 3) Obtain a WordPress API key by registering as a user on http://wordpress.com (WordPress.com not WordPress.org)
 * 4) Use require_once( "$IP/extensions/AkismetKlik/AkismetKlik.php" ); to include the extension from LocalSettings.php
 * 5) Edit AkismetKlik.php to customise the following configuration variables to match your sitename and ten-digit API key, for instance:
 * $wgAKkey='867-5309';                    // Jenny's personal API key at wordpress.org - keep this secret!
 * $siteURL='http://wiki.example.org';     // URL of the local wiki, $wgArticlePath is assumed to be /wiki/$1 under this

Testing
Akismet's servers are configured to flag all edits from User:Viagra-test-123 as unconditionally spam. Edit a page while logged out (or logged in as a different user) and the wiki should respond normally; attempt to edit while logged in under a test account User:Viagra-test-123 and every attempt should be rejected with a Spam Filter error. Akismet now checks the username with case sensitivity. MediaWiki capitalizes usernames, so this testing method is not effective. To test, you can patch the setCommentAuthor function in Akismet.class.php to strtolower the commentAuthor argument.

Limitations
This extension has been tested against the current MediaWiki release only; its compatibility with other versions of MediaWiki is unknown although it likely can be adapted in some form.

This extension does not currently provide a means to handle (or to report) false-positive or false-negative results. There are functions in the Akismet.class library to "report as spam" or "report as ham", but this extension does not make this functionality available to wiki admins.

There is also no direct MediaWiki equivalent to WordPress's capability to store suspected spam comments for later manual review. As such, text which triggers false-positive results cannot be edited or saved.

There is no check to prevent this from blocking edits from legit 'bot accounts, such as pywikipediabot. This can lead to many false-positives; it will most often be necessary to whitelist any accounts with the MediaWiki 'bot' permission by adding the following to the beginning of filter:

A similar approach may be used to disable the Akismet filter for other specific user groups, such as autoconfirmed users or administrators.

The page title (MW 1.12 only) is passed to Akismet in the "permalink" field and the URL field is populated based on the first external link found in the message body. It may make more sense to change the submitted query to use the wiki edit comment field data in some manner - most likely by re-purposing an existing field, given that the field names are based on WordPress' design, not wiki.

Alternatives
ScribbleWiki has developed their own Akismet extension, Akismetcheck. However, this is not available anymore.

ScribbleWiki's AkismetCheck was downloadable at http://scribblewiki.com/akismet (code released under GPL).

Disclaimers
The PHP5 code structure is based loosely on that of existing extension code, specifically Extension:SpamBlacklist, which is open-source under the GPL.