X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpopulateRecentChangesSource.php;h=4ac348672b024b3c9e67f0953c57f599b94b5347;hb=16c80e429be5904fb42a93f260f8de3d18f0c692;hp=5d5da89a8c328741bb49fff1f67f4864827aafd6;hpb=cf35ff756c89ca6d6e003b440076df5ebe7ccef7;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateRecentChangesSource.php b/maintenance/populateRecentChangesSource.php index 5d5da89a8c..4ac348672b 100644 --- a/maintenance/populateRecentChangesSource.php +++ b/maintenance/populateRecentChangesSource.php @@ -41,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.' ); } @@ -52,21 +53,19 @@ 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 ], [ "rc_source = ''", - "rc_id BETWEEN $blockStart AND $blockEnd" + "rc_id BETWEEN " . (int)$blockStart . " AND " . (int)$blockEnd ], __METHOD__ ); @@ -74,8 +73,8 @@ class PopulateRecentChangesSource extends LoggedUpdateMaintenance { $this->output( "." ); wfWaitForSlaves(); - $blockStart += $this->mBatchSize; - $blockEnd += $this->mBatchSize; + $blockStart += $batchSize; + $blockEnd += $batchSize; } $this->output( "\nDone.\n" ); @@ -105,5 +104,5 @@ class PopulateRecentChangesSource extends LoggedUpdateMaintenance { } } -$maintClass = "PopulateRecentChangesSource"; +$maintClass = PopulateRecentChangesSource::class; require_once RUN_MAINTENANCE_IF_MAIN;