Extension:NotEvil

What can this extension do?
This extension (technically, a $wgFilterCallback function, not a regular extension) blocks any edit that contains a url unless the users is on the "Not Evil" list. An example mechanism for updating the not evil list using a protected wiki page is also provided.

The Not Evil list is simply a text file containing usernames who are allowed to make edits that include URLs.

This filter also attempts to deceive spammers into believing their edits have succeeded. This does mean that anonymous users who make legitimate edits containing non-spammy URLs get blocked without any feedback that they are getting blocked, but in real-life usage this is an astonishingly rare edge case (you would think it would be common, but when you are only blocking edits with URLs it actually isn't)

Development
This code is in use, and is highly effective, but could really use some cleanup and simplification. Help is welcome!


 * Is there a better way to detect which lines changed? The current method is slow, and I don't trust my own temp-file code.
 * Can $basePath be removed or replaced with something provided by MediaWiki? it would make configuration simpler.
 * Use $IP. —Emufarmers(T 01:01, 30 April 2008 (UTC)
 * Thanks! Fixed. --Bob the Hamster 16:35, 15 February 2011 (UTC)


 * How could this filter be best implemented as a real extension, rather than just a $wgFilterCallback?
 * Would it be possible to implement NotEvilness as a real account permission?
 * The example script for refreshing the notevil.txt file needs to be rewritten in php. Not everybody can run shell scripts (and even fewer have the pcregrep command that the example requires) but everybody who is running Mediawiki will be able to run php

Cleaned-up code
Here's some helping... I've cleaned up the code and separated it into two extensions, "TrustedLinks" and "UntrustedLinksLogger". You can check out the files here:
 * TrustedLinks.php
 * TrustedLinks.i18n.php
 * UntrustedLinksLogger.php
 * UntrustedLinksLogger.i18n.php

I'll write more on the talk page. --Laird (talk) 23:12, 9 July 2012 (UTC)

Generating not.evil.txt
You can use a cron job like this to update the not.evil.txt file once an hour.