Merge "Use the phan exit code directly"
[lhc/web/wiklou.git] / maintenance / removeInvalidEmails.php
index 265723a..1034005 100644 (file)
@@ -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 ) {