* Use WikiPage instead of Article to call commitRollback()
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 14 Jan 2012 14:11:08 +0000 (14:11 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 14 Jan 2012 14:11:08 +0000 (14:11 +0000)
* Pass the User object from WikiPage::commitRollback() to WikiPage::doEdit()
* Do the edits with 'Maintenance script' user as other maintenance scripts instead of 127.0.0.1

includes/WikiPage.php
maintenance/rollbackEdits.php

index 83f73e0..0395471 100644 (file)
@@ -2220,7 +2220,7 @@ class WikiPage extends Page {
                }
 
                # Actually store the edit
-               $status = $this->doEdit( $target->getText(), $summary, $flags, $target->getId() );
+               $status = $this->doEdit( $target->getText(), $summary, $flags, $target->getId(), $guser );
                if ( !empty( $status->value['revision'] ) ) {
                        $revId = $status->value['revision']->getId();
                } else {
index 6a7e85a..3e57e01 100644 (file)
@@ -62,10 +62,12 @@ class RollbackEdits extends Maintenance {
                        return;
                }
 
+               $doer = User::newFromName( 'Maintenance script' );
+
                foreach ( $titles as $t ) {
-                       $a = new Article( $t );
-                       $this->output( 'Processing ' . $t->getPrefixedText() . '...' );
-                       if ( !$a->commitRollback( $user, $summary, $bot, $results ) ) {
+                       $page = WikiPage::factory( $t );
+                       $this->output( 'Processing ' . $t->getPrefixedText() . '... ' );
+                       if ( !$page->commitRollback( $user, $summary, $bot, $results, $doer ) ) {
                                $this->output( "done\n" );
                        } else {
                                $this->output( "failed\n" );