* (bug 4220) the XML dump format schema now have unique identity constraints
for page and revision identifiers. Patch by Elvis Stansvik.
* (bug 35705) QUnit upgraded from 1.2.0 to 1.7.0
+* cleanupSpam.php now can delete spam pages if --delete was specified instead of blanking
+ them.
=== Bug fixes in 1.20 ===
* (bug 30245) Use the correct way to construct a log page title.
'spambot_username' => 'MediaWiki spam cleanup',
'spam_reverting' => 'Reverting to last revision not containing links to $1',
'spam_blanking' => 'All revisions contained links to $1, blanking',
+'spam_deleting' => 'All revisions contained links to $1, deleting',
# Info page
'pageinfo-title' => 'Information for "$1"',
require_once( dirname( __FILE__ ) . '/Maintenance.php' );
class CleanupSpam extends Maintenance {
+
public function __construct() {
parent::__construct();
$this->mDescription = "Cleanup all spam from a given hostname";
$this->addOption( 'all', 'Check all wikis in $wgLocalDatabases' );
- $this->addArg( 'hostname', 'Hostname that was spamming' );
+ $this->addOption( 'delete', 'Delete pages containing only spam instead of blanking them' );
+ $this->addArg( 'hostname', 'Hostname that was spamming, single * wildcard in the beginning allowed' );
}
public function execute() {
$dbw = wfGetDB( DB_MASTER );
$dbw->begin( __METHOD__ );
$page = WikiPage::factory( $title );
- if ( !$rev ) {
- // Didn't find a non-spammy revision, blank the page
- $this->output( "blanking\n" );
- $page->doEdit( '', wfMsgForContent( 'spam_blanking', $domain ) );
- } else {
+ if ( $rev ) {
// Revert to this revision
$this->output( "reverting\n" );
$page->doEdit( $rev->getText(), wfMsgForContent( 'spam_reverting', $domain ),
EDIT_UPDATE, $rev->getId() );
+ } elseif ( $this->hasOption( 'delete' ) ) {
+ // Didn't find a non-spammy revision, blank the page
+ $this->output( "deleting\n" );
+ $page->doDeleteArticle( wfMsgForContent( 'spam_deleting', $domain ) );
+ } else {
+ // Didn't find a non-spammy revision, blank the page
+ $this->output( "blanking\n" );
+ $page->doEdit( '', wfMsgForContent( 'spam_blanking', $domain ) );
}
$dbw->commit( __METHOD__ );
}