X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FremoveInvalidEmails.php;h=1034005aa0c891700406dd9942e8837264f33a03;hb=87a0b17127195742e6c64472dbfdac65b4d254d7;hp=265723a40c2659dfa1d6f02c245206a8699a33e4;hpb=4cabe55d0f8aa5f4181c2591c8e0f3e139268128;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 ) {