X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FremoveInvalidEmails.php;h=1034005aa0c891700406dd9942e8837264f33a03;hb=052c6c9aedfce9b5470f5709da14268bc7c8bc38;hp=265723a40c2659dfa1d6f02c245206a8699a33e4;hpb=b9705e532dd549c5b718a4d8c355c0e1abb87aed;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/removeInvalidEmails.php b/maintenance/removeInvalidEmails.php index 265723a40c..1034005aa0 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->mBatchSize ] ); $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 ) {