From 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 12 Aug 2013 09:28:15 +0200 Subject: Update to MediaWiki 1.21.1 --- maintenance/cleanupSpam.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'maintenance/cleanupSpam.php') diff --git a/maintenance/cleanupSpam.php b/maintenance/cleanupSpam.php index e20bcd87..a41423ae 100644 --- a/maintenance/cleanupSpam.php +++ b/maintenance/cleanupSpam.php @@ -44,7 +44,7 @@ class CleanupSpam extends Maintenance { $username = wfMessage( 'spambot_username' )->text(); $wgUser = User::newFromName( $username ); if ( !$wgUser ) { - $this->error( "Invalid username", true ); + $this->error( "Invalid username specified in 'spambot_username' message: $username", true ); } // Create the user if necessary if ( !$wgUser->getId() ) { @@ -103,7 +103,8 @@ class CleanupSpam extends Maintenance { $rev = Revision::newFromTitle( $title ); $currentRevId = $rev->getId(); - while ( $rev && ( $rev->isDeleted( Revision::DELETED_TEXT ) || LinkFilter::matchEntry( $rev->getText() , $domain ) ) ) { + while ( $rev && ( $rev->isDeleted( Revision::DELETED_TEXT ) + || LinkFilter::matchEntry( $rev->getContent( Revision::RAW ), $domain ) ) ) { $rev = $rev->getPrevious(); } @@ -117,8 +118,10 @@ class CleanupSpam extends Maintenance { $page = WikiPage::factory( $title ); if ( $rev ) { // Revert to this revision + $content = $rev->getContent( Revision::RAW ); + $this->output( "reverting\n" ); - $page->doEdit( $rev->getText(), wfMessage( 'spam_reverting', $domain )->inContentLanguage()->text(), + $page->doEditContent( $content, wfMessage( 'spam_reverting', $domain )->inContentLanguage()->text(), EDIT_UPDATE, $rev->getId() ); } elseif ( $this->hasOption( 'delete' ) ) { // Didn't find a non-spammy revision, blank the page @@ -126,8 +129,11 @@ class CleanupSpam extends Maintenance { $page->doDeleteArticle( wfMessage( 'spam_deleting', $domain )->inContentLanguage()->text() ); } else { // Didn't find a non-spammy revision, blank the page + $handler = ContentHandler::getForTitle( $title ); + $content = $handler->makeEmptyContent(); + $this->output( "blanking\n" ); - $page->doEdit( '', wfMessage( 'spam_blanking', $domain )->inContentLanguage()->text() ); + $page->doEditContent( $content, wfMessage( 'spam_blanking', $domain )->inContentLanguage()->text() ); } $dbw->commit( __METHOD__ ); } -- cgit v1.2.3-54-g00ecf