X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FremoveInvalidEmails.php;h=91025bf109ffb9c84d12e80cb81c2c4b4879f204;hb=19d24c13d68e89726c9c93d25d009a162aee8176;hp=265723a40c2659dfa1d6f02c245206a8699a33e4;hpb=96a8ab6928b3e0be884c33eed8a1febf6fc4c31e;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/removeInvalidEmails.php b/maintenance/removeInvalidEmails.php index 265723a40c..91025bf109 100644 --- a/maintenance/removeInvalidEmails.php +++ b/maintenance/removeInvalidEmails.php @@ -23,23 +23,23 @@ class RemoveInvalidEmails extends Maintenance { } public function execute() { $this->commit = $this->hasOption( 'commit' ); - $dbr = $this->getDB( DB_SLAVE ); + $dbr = $this->getDB( DB_REPLICA ); $dbw = $this->getDB( DB_MASTER ); $lastId = 0; do { $rows = $dbr->select( 'user', - array( 'user_id', 'user_email' ), - array( + [ 'user_id', 'user_email' ], + [ 'user_id > ' . $dbr->addQuotes( $lastId ), 'user_email != ""', 'user_email_authenticated IS NULL' - ), + ], __METHOD__, - array( 'LIMIT' => $this->mBatchSize ) + [ 'LIMIT' => $this->getBatchSize() ] ); $count = $rows->numRows(); - $badIds = array(); + $badIds = []; foreach ( $rows as $row ) { if ( !Sanitizer::validateEmail( trim( $row->user_email ) ) ) { $this->output( "Found bad email: {$row->user_email} for user #{$row->user_id}\n" ); @@ -56,8 +56,8 @@ class RemoveInvalidEmails extends Maintenance { $this->output( "Removing $badCount emails from the database.\n" ); $dbw->update( 'user', - array( 'user_email' => '' ), - array( 'user_id' => $badIds ), + [ 'user_email' => '' ], + [ 'user_id' => $badIds ], __METHOD__ ); foreach ( $badIds as $badId ) {