Merge "Warn if stateful ParserOutput transforms are used"
[lhc/web/wiklou.git] / maintenance / populateLogSearch.php
index 1b07407..f960753 100644 (file)
@@ -53,6 +53,7 @@ class PopulateLogSearch extends LoggedUpdateMaintenance {
        }
 
        protected function doDBUpdates() {
+               $batchSize = $this->getBatchSize();
                $db = $this->getDB( DB_MASTER );
                if ( !$db->tableExists( 'log_search' ) ) {
                        $this->error( "log_search does not exist" );
@@ -68,15 +69,17 @@ class PopulateLogSearch extends LoggedUpdateMaintenance {
                $end = $db->selectField( 'logging', 'MAX(log_id)', false, __FUNCTION__ );
 
                # Do remaining chunk
-               $end += $this->mBatchSize - 1;
+               $end += $batchSize - 1;
                $blockStart = $start;
-               $blockEnd = $start + $this->mBatchSize - 1;
+               $blockEnd = $start + $batchSize - 1;
 
                $delTypes = [ 'delete', 'suppress' ]; // revisiondelete types
                while ( $blockEnd <= $end ) {
                        $this->output( "...doing log_id from $blockStart to $blockEnd\n" );
-                       $cond = "log_id BETWEEN $blockStart AND $blockEnd";
-                       $res = $db->select( 'logging', '*', $cond, __FUNCTION__ );
+                       $cond = "log_id BETWEEN " . (int)$blockStart . " AND " . (int)$blockEnd;
+                       $res = $db->select(
+                               'logging', [ 'log_id', 'log_type', 'log_action', 'log_params' ], $cond, __FUNCTION__
+                       );
                        foreach ( $res as $row ) {
                                // RevisionDelete logs - revisions
                                if ( LogEventsList::typeAction( $row, $delTypes, 'revision' ) ) {
@@ -156,8 +159,8 @@ class PopulateLogSearch extends LoggedUpdateMaintenance {
                                        $log->addRelations( 'target_author_ip', $userIPs, $row->log_id );
                                }
                        }
-                       $blockStart += $this->mBatchSize;
-                       $blockEnd += $this->mBatchSize;
+                       $blockStart += $batchSize;
+                       $blockEnd += $batchSize;
                        wfWaitForSlaves();
                }
                $this->output( "Done populating log_search table.\n" );
@@ -166,5 +169,5 @@ class PopulateLogSearch extends LoggedUpdateMaintenance {
        }
 }
 
-$maintClass = "PopulateLogSearch";
+$maintClass = PopulateLogSearch::class;
 require_once RUN_MAINTENANCE_IF_MAIN;