Extension:SpamDiffTool

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
SpamDiffTool

Release status: unknown

SpamDiffTool Screenshot.png
Implementation User activity, Page action
Description allows users to add entries to the Spam blacklist right off of a diff page
Author(s) Travis Derouin (Tderouintalk)
Latest version 0.1 (2006-11-08)
MediaWiki 1.6+
License No license specified
Download

Translate the SpamDiffTool extension if possible

Check usage and version matrix; code metrics

The SpamDiffTool extension allows users to add URLs to the Spam Blacklist easily without learning how to format entries for the blacklist and copy and paste, etc. By inserting a link on each diff page, if an editor sees that a given page has been the victim of spam, they can click on "add to spam", which extracts all of the URLs the spammer has placed on the page, going back over their most recent edits on the article (similar to Rollback). Then, for each URL detected, the tool prompts the user the degree to which they want to blacklist the URL. The options are block:

  1. all links from the domain
  2. all links from the specific subdomain
  3. all links from the subdirectory and subdomain
  4. nothing - don't add this to the blacklist

The idea is to try to streamline the process of cleaning up spam, rolling back spam edits and blocking users. When the spam addition process is finished, the user is taken back to the diff page they were on to begin with. From there, they can rollback the edits as required.

As of November 9, 2006 this tool has been running for a few weeks on wikiHow, and made the lives of some admins much easier. Future versions might include the ability to block the user while adding the links to the spam blacklist, and rolling back the edits all at once.

License[edit | edit source]

Copyright 2006 Travis Derouin

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Author[edit | edit source]

Travis Derouin ( travis @ wikihow.com)

Pre-requisites[edit | edit source]

This extension was tested with MediaWiki 1.6.7 and MediaWiki 1.8.2.

Installation[edit | edit source]

To install, copy the file SpamDiffTool.php in the archive you downloaded to your extensions directory.

In your MediaWiki LocalSettings.php, add the following line some place towards the bottom of the file:

require_once("$IP/extensions/SpamDiffTool.php");

Then, unfortunately, you have to hack 2 files to get the "add to spam" link placed on the appropriate diff pages.

MediaWiki 1.6.7 & 1.8.2[edit | edit source]

In DifferenceEngine.php, in showDiffPage, add after this section:

                if ( $this->mNewRev->isCurrent() && $wgUser->isAllowed('rollback') ) {
                        $username = $this->mNewRev->getUserText();                        
                        $rollback = '&nbsp;&nbsp;&nbsp;<strong>[' . $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'rollbacklink' ),
                                'action=rollback&from=' . urlencode( $username ) .
                                '&token=' . urlencode( $wgUser->editToken( array( $this->mTitle->getPrefixedText(), $username ) ) ) ) .
                                ']</strong>';
                } else {
                        $rollback = '';
                }

The line:

                $rollback .= '<br/>&nbsp;&nbsp;&nbsp;<strong>' . wfSpamDiffLink($this->mTitle) . '</strong>';

Then, there's another change so that new pages also get this feature, edit Article.php at line 930:

            $wgOut->addHTML( 
                "<div class='patrollink'>" .
                    wfMsg ( 'markaspatrolledlink',
                    $sk->makeKnownLinkObj( $this->mTitle, wfMsg('markaspatrolledtext'), "action=markpatrolled&rcid=$rcid" )
                    ) .
+                wfSpamDiffLink ($this->mTitle) .
                '</div>'

Configuration[edit | edit source]

To specify which article you use as a Spam Blacklist, change the $wgSpamBlacklistArticle variable in SpamDiffTool.php.

Bugs and enhancements[edit | edit source]

Bugs or feature requests can be sent to the author at travis @ wikihow.com. There is a good chance the regular expressions are not 100% perfect.

See also[edit | edit source]