X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpopulateRevisionLength.php;h=5de5819735732e7f60f1bcc25152d08f31fdd37e;hb=2f15b22b91c0426b06e9ece9ffd2aa14fbdaa621;hp=a9457c2a1cd13f65b078bc4b734b4174f526fba2;hpb=32f52cbacd760f8c1cb60345fe0310cbc8d7a4ec;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateRevisionLength.php b/maintenance/populateRevisionLength.php index a9457c2a1c..5de5819735 100644 --- a/maintenance/populateRevisionLength.php +++ b/maintenance/populateRevisionLength.php @@ -54,10 +54,10 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance { } $this->output( "Populating rev_len column\n" ); - $rev = $this->doLenUpdates( 'revision', 'rev_id', 'rev', Revision::selectFields() ); + $rev = $this->doLenUpdates( 'revision', 'rev_id', 'rev', Revision::getQueryInfo() ); $this->output( "Populating ar_len column\n" ); - $ar = $this->doLenUpdates( 'archive', 'ar_id', 'ar', Revision::selectArchiveFields() ); + $ar = $this->doLenUpdates( 'archive', 'ar_id', 'ar', Revision::getArchiveQueryInfo() ); $this->output( "rev_len and ar_len population complete " . "[$rev revision rows, $ar archive rows].\n" ); @@ -69,12 +69,13 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance { * @param string $table * @param string $idCol * @param string $prefix - * @param array $fields + * @param array $queryInfo * @return int */ - protected function doLenUpdates( $table, $idCol, $prefix, $fields ) { + 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,20 +86,22 @@ 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 ) { $this->output( "...doing $idCol from $blockStart to $blockEnd\n" ); $res = $dbr->select( - $table, - $fields, + $queryInfo['tables'], + $queryInfo['fields'], [ "$idCol >= $blockStart", "$idCol <= $blockEnd", "{$prefix}_len IS NULL" ], - __METHOD__ + __METHOD__, + [], + $queryInfo['joins'] ); if ( $res->numRows() > 0 ) { @@ -112,8 +115,8 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance { $this->commitTransaction( $dbw, __METHOD__ ); } - $blockStart += $this->mBatchSize; - $blockEnd += $this->mBatchSize; + $blockStart += $batchSize; + $blockEnd += $batchSize; wfWaitForSlaves(); }