PopulateRecentChangesSource: remove unused variable
[lhc/web/wiklou.git] / maintenance / populateRecentChangesSource.php
index ac87cf3..04ad255 100644 (file)
@@ -23,6 +23,8 @@
 
 require_once __DIR__ . '/Maintenance.php';
 
+use Wikimedia\Rdbms\IDatabase;
+
 /**
  * Maintenance script to populate the rc_source field.
  *
@@ -39,6 +41,7 @@ class PopulateRecentChangesSource extends LoggedUpdateMaintenance {
 
        protected function doDBUpdates() {
                $dbw = $this->getDB( DB_MASTER );
+               $batchSize = $this->getBatchSize();
                if ( !$dbw->fieldExists( 'recentchanges', 'rc_source' ) ) {
                        $this->error( 'rc_source field in recentchanges table does not exist.' );
                }
@@ -50,15 +53,13 @@ class PopulateRecentChangesSource extends LoggedUpdateMaintenance {
                        return true;
                }
                $end = $dbw->selectField( 'recentchanges', 'MAX(rc_id)', false, __METHOD__ );
-               $end += $this->mBatchSize - 1;
+               $end += $batchSize - 1;
                $blockStart = $start;
-               $blockEnd = $start + $this->mBatchSize - 1;
+               $blockEnd = $start + $batchSize - 1;
 
                $updatedValues = $this->buildUpdateCondition( $dbw );
 
                while ( $blockEnd <= $end ) {
-                       $cond = "rc_id BETWEEN $blockStart AND $blockEnd";
-
                        $dbw->update(
                                'recentchanges',
                                [ $updatedValues ],
@@ -72,8 +73,8 @@ class PopulateRecentChangesSource extends LoggedUpdateMaintenance {
                        $this->output( "." );
                        wfWaitForSlaves();
 
-                       $blockStart += $this->mBatchSize;
-                       $blockEnd += $this->mBatchSize;
+                       $blockStart += $batchSize;
+                       $blockEnd += $batchSize;
                }
 
                $this->output( "\nDone.\n" );
@@ -83,7 +84,7 @@ class PopulateRecentChangesSource extends LoggedUpdateMaintenance {
                return __CLASS__;
        }
 
-       protected function buildUpdateCondition( Database $dbw ) {
+       protected function buildUpdateCondition( IDatabase $dbw ) {
                $rcNew = $dbw->addQuotes( RC_NEW );
                $rcSrcNew = $dbw->addQuotes( RecentChange::SRC_NEW );
                $rcEdit = $dbw->addQuotes( RC_EDIT );