X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpopulateRevisionLength.php;h=f83be9c793b8934e649d732bedbc4c2979e89f76;hb=3e16cc20e886a1fc487bad746632ed50bfd7906c;hp=0cb14c42c8d6495dc020a98205a4076c118f7808;hpb=db7d59355e4c8b70fc0a510f9bfde93134d6991c;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateRevisionLength.php b/maintenance/populateRevisionLength.php index 0cb14c42c8..f83be9c793 100644 --- a/maintenance/populateRevisionLength.php +++ b/maintenance/populateRevisionLength.php @@ -44,9 +44,9 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance { public function doDBUpdates() { $dbw = $this->getDB( DB_MASTER ); if ( !$dbw->tableExists( 'revision' ) ) { - $this->error( "revision table does not exist", true ); + $this->fatalError( "revision table does not exist" ); } elseif ( !$dbw->tableExists( 'archive' ) ) { - $this->error( "archive table does not exist", true ); + $this->fatalError( "archive table does not exist" ); } elseif ( !$dbw->fieldExists( 'revision', 'rev_len', __METHOD__ ) ) { $this->output( "rev_len column does not exist\n\n", true ); @@ -75,6 +75,7 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance { protected function doLenUpdates( $table, $idCol, $prefix, $queryInfo ) { $dbr = $this->getDB( DB_REPLICA ); $dbw = $this->getDB( DB_MASTER ); + $batchSize = $this->getBatchSize(); $start = $dbw->selectField( $table, "MIN($idCol)", false, __METHOD__ ); $end = $dbw->selectField( $table, "MAX($idCol)", false, __METHOD__ ); if ( !$start || !$end ) { @@ -85,7 +86,7 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance { # Do remaining chunks $blockStart = intval( $start ); - $blockEnd = intval( $start ) + $this->mBatchSize - 1; + $blockEnd = intval( $start ) + $batchSize - 1; $count = 0; while ( $blockStart <= $end ) { @@ -114,8 +115,8 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance { $this->commitTransaction( $dbw, __METHOD__ ); } - $blockStart += $this->mBatchSize; - $blockEnd += $this->mBatchSize; + $blockStart += $batchSize; + $blockEnd += $batchSize; wfWaitForSlaves(); } @@ -156,5 +157,5 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance { } } -$maintClass = "PopulateRevisionLength"; +$maintClass = PopulateRevisionLength::class; require_once RUN_MAINTENANCE_IF_MAIN;