X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=blobdiff_plain;f=maintenance%2FcleanupSpam.php;h=3d039fa292f1664e6f421b67ad7fda5d719c4d10;hb=2c2dc593d25f652c04185e597b7f9de2c22c2e31;hp=4e47cfba57a88043e6edd40bcf88506e3609bd8f;hpb=f6c8b955bd6103e3084ec609902e68599cf11f23;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/cleanupSpam.php b/maintenance/cleanupSpam.php index 4e47cfba57..3d039fa292 100644 --- a/maintenance/cleanupSpam.php +++ b/maintenance/cleanupSpam.php @@ -47,16 +47,15 @@ class CleanupSpam extends Maintenance { $username = wfMessage( 'spambot_username' )->text(); $wgUser = User::newSystemUser( $username ); if ( !$wgUser ) { - $this->error( "Invalid username specified in 'spambot_username' message: $username", true ); - } - // Create the user if necessary - if ( !$wgUser->getId() ) { - $wgUser->addToDatabase(); + $this->fatalError( "Invalid username specified in 'spambot_username' message: $username" ); } + // Hack: Grant bot rights so we don't flood RecentChanges + $wgUser->addGroup( 'bot' ); + $spec = $this->getArg(); $like = LinkFilter::makeLikeArray( $spec ); if ( !$like ) { - $this->error( "Not a valid hostname specification: $spec", true ); + $this->fatalError( "Not a valid hostname specification: $spec" ); } if ( $this->hasOption( 'all' ) ) { @@ -131,7 +130,7 @@ class CleanupSpam extends Maintenance { $page->doEditContent( $content, wfMessage( 'spam_reverting', $domain )->inContentLanguage()->text(), - EDIT_UPDATE, + EDIT_UPDATE | EDIT_FORCE_BOT, $rev->getId() ); } elseif ( $this->hasOption( 'delete' ) ) { @@ -148,7 +147,8 @@ class CleanupSpam extends Maintenance { $this->output( "blanking\n" ); $page->doEditContent( $content, - wfMessage( 'spam_blanking', $domain )->inContentLanguage()->text() + wfMessage( 'spam_blanking', $domain )->inContentLanguage()->text(), + EDIT_UPDATE | EDIT_FORCE_BOT ); } $this->commitTransaction( $dbw, __METHOD__ );