X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FfixUserRegistration.php;h=f4674cb29412a8e2968018e0cc2b23ef43fcaf1d;hb=c292cfd90f1b9f2939b6bc1e19e15700a87a037c;hp=40e091595e482de345050a5fab2b316311fcf973;hpb=8a00f2445d9d34b9e72fadbca144f110abe65656;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/fixUserRegistration.php b/maintenance/fixUserRegistration.php index 40e091595e..f4674cb294 100644 --- a/maintenance/fixUserRegistration.php +++ b/maintenance/fixUserRegistration.php @@ -32,12 +32,12 @@ require_once __DIR__ . '/Maintenance.php'; class FixUserRegistration extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Fix the user_registration field"; + $this->addDescription( 'Fix the user_registration field' ); $this->setBatchSize( 1000 ); } public function execute() { - $dbw = wfGetDB( DB_MASTER ); + $dbw = $this->getDB( DB_MASTER ); $lastId = 0; do { @@ -45,15 +45,15 @@ class FixUserRegistration extends Maintenance { $res = $dbw->select( 'user', 'user_id', - array( + [ 'user_id > ' . $dbw->addQuotes( $lastId ), 'user_registration IS NULL' - ), + ], __METHOD__, - array( + [ 'LIMIT' => $this->mBatchSize, 'ORDER BY' => 'user_id', - ) + ] ); foreach ( $res as $row ) { $id = $row->user_id; @@ -62,15 +62,15 @@ class FixUserRegistration extends Maintenance { $timestamp = $dbw->selectField( 'revision', 'MIN(rev_timestamp)', - array( 'rev_user' => $id ), + [ 'rev_user' => $id ], __METHOD__ ); // Update if ( $timestamp !== null ) { $dbw->update( 'user', - array( 'user_registration' => $timestamp ), - array( 'user_id' => $id ), + [ 'user_registration' => $timestamp ], + [ 'user_id' => $id ], __METHOD__ ); $user = User::newFromId( $id );