Extension talk:NotEvil
Works Great! Thanks! -glenn
Not very user-friendly in instruction
editI would love to use this, but am unsure as to what I would be doing with this code. I can see I need to save things, but can we have clear, specific instructions on what to save, where, what to save it as, and how to include it in LocalSettings? Thanks. --JoJo 86.148.233.251 10:02, 29 March 2011 (UTC)
Am dying to use this, but can't understand it
editCould someone describe how to create the spammer.log and not.evil.txt file? The code at the end seems to be the not.evil.txt file, but am not certain. Also, it looks like a sysops would add URLs to "NOTEVILFILE=" but am not certain if a list of allowed URLs would be separated by semicolons or commas or whatever and if the quotes would be included.
Many MediaWiki users would be greatful for more instruction. I don't know much about PHP, so need to rely on instructions in the code. Have uploaded several other extensions and got them to work. This one looks like a great addition, but just can't figure out how to get it going... Thanks. --LWells 05:49, 22 July 2011 (UTC)
Cleaned up code
editHi James, thanks for this extension, it's a neat idea and just what I think I'm going to need for our wiki if the recent spate of spam continues. Since you asked for help, and since I thought the extension was worth it, I've cleaned up the code, split it into two extensions, and dealt with a few issues. I've included you as joint author on the new files - I hope that's what you want. In response to your questions on the main page:
"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."
Yes, MediaWiki has its own Diff code - I replaced your call out to an external diff program with a call to WikiDiff3::diff_range() and a bit of iteration over the results.
"How could this filter be best implemented as a real extension, rather than just a $wgFilterCallback?"
$wgFilterCallback is now deprecated, so I replaced it with a hook into EditFilter. Other than that, all I did for each extension was add an entry in $wgExtensionCredits, and an internationalisation file.
"Would it be possible to implement NotEvilness as a real account permission?"
Yes, via a call to $wgUser->isAllowed(). You then as a wiki admin just have to set $wgGroupPermissions for the right you specify in that call (I chose 'postlink'), and then you can add users to the relevant groups via Special:UserRights.
"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"
Doing this via user rights eliminates the need for a list of not-evil users - simply add the user(s) to a group with the 'postlink' right.
Other changes I've made to the code are:
- Introduced a customisable regular expression that identifies URLs. By default it detects URLs starting with http(s):// and (s)ftp://, as well as bare domain names starting with a variant of www, such as www2.spam.com, and most bare URLs that extend beyond the domain name, such as spam.com/spammy-page.
- Introduced a reliable check that the link is actually new and definitely didn't already exist on the page.
- Removed the deceptive output because it can also deceive legitimate users who haven't yet been given the right to post links (and don't know that a right is required).
I've documented all required configuration and possible settings at the top of each extension file.
I hope this helps - let me know what you think. Cheers. --Laird (talk) 23:46, 9 July 2012 (UTC)
Hello, Laird! Your cleaned-up version of this code looks great! Thank you! Bob the Hamster (talk) 17:24, 28 November 2012 (UTC)