X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpopulateParentId.php;h=2ef58b7c6154910b1160ca2512396511bbac04cd;hb=2323b0ba8161892714c3aba9fc6a4212397e0283;hp=457033a4fa4a23566ad9c75ea00788bbea9e3181;hpb=939199bcea28a3b13c49c0f808d11d415660b924;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateParentId.php b/maintenance/populateParentId.php index 457033a4fa..2ef58b7c61 100644 --- a/maintenance/populateParentId.php +++ b/maintenance/populateParentId.php @@ -46,6 +46,7 @@ class PopulateParentId extends LoggedUpdateMaintenance { } protected function doDBUpdates() { + $batchSize = $this->getBatchSize(); $db = $this->getDB( DB_MASTER ); if ( !$db->tableExists( 'revision' ) ) { $this->error( "revision table does not exist" ); @@ -53,8 +54,8 @@ class PopulateParentId extends LoggedUpdateMaintenance { return false; } $this->output( "Populating rev_parent_id column\n" ); - $start = $db->selectField( 'revision', 'MIN(rev_id)', false, __FUNCTION__ ); - $end = $db->selectField( 'revision', 'MAX(rev_id)', false, __FUNCTION__ ); + $start = $db->selectField( 'revision', 'MIN(rev_id)', '', __FUNCTION__ ); + $end = $db->selectField( 'revision', 'MAX(rev_id)', '', __FUNCTION__ ); if ( is_null( $start ) || is_null( $end ) ) { $this->output( "...revision table seems to be empty, nothing to do.\n" ); @@ -62,7 +63,7 @@ class PopulateParentId extends LoggedUpdateMaintenance { } # Do remaining chunk $blockStart = intval( $start ); - $blockEnd = intval( $start ) + $this->mBatchSize - 1; + $blockEnd = intval( $start ) + $batchSize - 1; $count = 0; $changed = 0; while ( $blockStart <= $end ) { @@ -116,8 +117,8 @@ class PopulateParentId extends LoggedUpdateMaintenance { __METHOD__ ); $count++; } - $blockStart += $this->mBatchSize; - $blockEnd += $this->mBatchSize; + $blockStart += $batchSize; + $blockEnd += $batchSize; wfWaitForSlaves(); } $this->output( "rev_parent_id population complete ... {$count} rows [{$changed} changed]\n" ); @@ -126,5 +127,5 @@ class PopulateParentId extends LoggedUpdateMaintenance { } } -$maintClass = "PopulateParentId"; +$maintClass = PopulateParentId::class; require_once RUN_MAINTENANCE_IF_MAIN;