Update cleanupSpam.php to hide its activity from RecentChanges
[lhc/web/wiklou.git] / maintenance / cleanupSpam.php
index 4e47cfb..fc3cc5b 100644 (file)
@@ -49,10 +49,9 @@ class CleanupSpam extends Maintenance {
                if ( !$wgUser ) {
                        $this->error( "Invalid username specified in 'spambot_username' message: $username", true );
                }
-               // Create the user if necessary
-               if ( !$wgUser->getId() ) {
-                       $wgUser->addToDatabase();
-               }
+               // Hack: Grant bot rights so we don't flood RecentChanges
+               $wgUser->addGroup( 'bot' );
+
                $spec = $this->getArg();
                $like = LinkFilter::makeLikeArray( $spec );
                if ( !$like ) {
@@ -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__ );