r108900 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108899‎ | r108900 | r108901 >
Date:14:11, 14 January 2012
Author:ialex
Status:ok
Tags:
Comment:
* 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
Modified paths:
  • /trunk/phase3/includes/WikiPage.php (modified) (history)
  • /trunk/phase3/maintenance/rollbackEdits.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/rollbackEdits.php
@@ -62,10 +62,12 @@
6363 return;
6464 }
6565
 66+ $doer = User::newFromName( 'Maintenance script' );
 67+
6668 foreach ( $titles as $t ) {
67 - $a = new Article( $t );
68 - $this->output( 'Processing ' . $t->getPrefixedText() . '...' );
69 - if ( !$a->commitRollback( $user, $summary, $bot, $results ) ) {
 69+ $page = WikiPage::factory( $t );
 70+ $this->output( 'Processing ' . $t->getPrefixedText() . '... ' );
 71+ if ( !$page->commitRollback( $user, $summary, $bot, $results, $doer ) ) {
7072 $this->output( "done\n" );
7173 } else {
7274 $this->output( "failed\n" );
Index: trunk/phase3/includes/WikiPage.php
@@ -2220,7 +2220,7 @@
22212221 }
22222222
22232223 # Actually store the edit
2224 - $status = $this->doEdit( $target->getText(), $summary, $flags, $target->getId() );
 2224+ $status = $this->doEdit( $target->getText(), $summary, $flags, $target->getId(), $guser );
22252225 if ( !empty( $status->value['revision'] ) ) {
22262226 $revId = $status->value['revision']->getId();
22272227 } else {

Status & tagging log