X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;ds=sidebyside;f=maintenance%2FrollbackEdits.php;h=5ad7d4e1c4eea5ceee79260d935c1a5216eaf8d4;hb=dcfec00f3b1224081e5192d5cf6d426a3c66029c;hp=713445357012bff3d87f2550c0af65468d7dc8e8;hpb=e2d6e193c94cb0b9b82654d2365113973dd41ecb;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/rollbackEdits.php b/maintenance/rollbackEdits.php index 7134453570..5ad7d4e1c4 100644 --- a/maintenance/rollbackEdits.php +++ b/maintenance/rollbackEdits.php @@ -33,8 +33,8 @@ require_once __DIR__ . '/Maintenance.php'; class RollbackEdits extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = - "Rollback all edits by a given user or IP provided they're the most recent edit"; + $this->addDescription( + "Rollback all edits by a given user or IP provided they're the most recent edit" ); $this->addOption( 'titles', 'A list of titles, none means all titles where the given user is the most recent', @@ -55,8 +55,8 @@ class RollbackEdits extends Maintenance { $bot = $this->hasOption( 'bot' ); $summary = $this->getOption( 'summary', $this->mSelf . ' mass rollback' ); - $titles = array(); - $results = array(); + $titles = []; + $results = []; if ( $this->hasOption( 'titles' ) ) { foreach ( explode( '|', $this->getOption( 'titles' ) ) as $title ) { $t = Title::newFromText( $title ); @@ -76,7 +76,7 @@ class RollbackEdits extends Maintenance { return; } - $doer = User::newSystemUser( 'Maintenance script', array( 'steal' => true ) ); + $doer = User::newSystemUser( 'Maintenance script', [ 'steal' => true ] ); foreach ( $titles as $t ) { $page = WikiPage::factory( $t ); @@ -95,12 +95,12 @@ class RollbackEdits extends Maintenance { * @return array */ private function getRollbackTitles( $user ) { - $dbr = $this->getDB( DB_SLAVE ); - $titles = array(); + $dbr = $this->getDB( DB_REPLICA ); + $titles = []; $results = $dbr->select( - array( 'page', 'revision' ), - array( 'page_namespace', 'page_title' ), - array( 'page_latest = rev_id', 'rev_user_text' => $user ), + [ 'page', 'revision' ], + [ 'page_namespace', 'page_title' ], + [ 'page_latest = rev_id', 'rev_user_text' => $user ], __METHOD__ ); foreach ( $results as $row ) {