From da4780c12ef20b28751896a996f7858ff6f683b5 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sat, 14 Jan 2012 14:11:08 +0000 Subject: [PATCH] * Use WikiPage instead of Article to call commitRollback() * 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 | 2 +- maintenance/rollbackEdits.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 83f73e0a69..039547196c 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -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 { diff --git a/maintenance/rollbackEdits.php b/maintenance/rollbackEdits.php index 6a7e85a1de..3e57e01fbf 100644 --- a/maintenance/rollbackEdits.php +++ b/maintenance/rollbackEdits.php @@ -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" ); -- 2.20.1