diff options
author | Amir Sarabadani <ladsgroup@gmail.com> | 2023-09-21 13:54:38 +0200 |
---|---|---|
committer | Amir Sarabadani <ladsgroup@gmail.com> | 2023-09-21 14:15:42 +0200 |
commit | eaedb7da16e6b3c398f1d34b156e144ba648f32d (patch) | |
tree | 3a27aa5410592a8d0f802679ad6309fcf22058c4 /maintenance/updateCollation.php | |
parent | e2bc1bb94251cfa789b757ff056bdcc98f0d5c52 (diff) | |
download | mediawikicore-eaedb7da16e6b3c398f1d34b156e144ba648f32d.tar.gz mediawikicore-eaedb7da16e6b3c398f1d34b156e144ba648f32d.zip |
maintenance: Migrate another batch to SelectQueryBuilder
Around fifty-ish. Found becuase of fixed MigrateSelect.
Bug: T344971
Change-Id: If85428d5a033822bfd8ee1f6ab730863bfad55bd
Diffstat (limited to 'maintenance/updateCollation.php')
-rw-r--r-- | maintenance/updateCollation.php | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index 221937a2c752..2adaf6e502c6 100644 --- a/maintenance/updateCollation.php +++ b/maintenance/updateCollation.php @@ -165,11 +165,6 @@ TEXT } else { $orderBy = 'cl_collation, cl_to, cl_type, cl_from'; } - $options = [ - 'LIMIT' => $batchSize, - 'ORDER BY' => $orderBy, - 'STRAIGHT_JOIN' // per T58041 - ]; $collationConds = []; if ( !$this->force && !$this->targetTable ) { @@ -189,12 +184,11 @@ TEXT ); // Improve estimate if feasible if ( $count < 1000000 ) { - $count = $this->dbr->selectField( - 'categorylinks', - 'COUNT(*)', - $collationConds, - __METHOD__ - ); + $count = $this->dbr->newSelectQueryBuilder() + ->select( 'COUNT(*)' ) + ->from( 'categorylinks' ) + ->where( $collationConds ) + ->caller( __METHOD__ )->fetchField(); } if ( $count == 0 ) { $this->output( "Collations up-to-date.\n" ); @@ -218,17 +212,20 @@ TEXT } else { $clType = 'cl_type'; } - $res = $this->dbw->select( - [ 'categorylinks', 'page' ], - [ + $res = $this->dbw->newSelectQueryBuilder() + ->select( [ 'cl_from', 'cl_to', 'cl_sortkey_prefix', 'cl_collation', 'cl_sortkey', $clType, 'cl_timestamp', 'page_namespace', 'page_title' - ], - array_merge( $collationConds, $batchConds, [ 'cl_from = page_id' ] ), - __METHOD__, - $options - ); + ] ) + ->from( 'categorylinks' ) + // per T58041 + ->straightJoin( 'page', null, 'cl_from = page_id' ) + ->where( $collationConds ) + ->andWhere( $batchConds ) + ->limit( $batchSize ) + ->orderBy( $orderBy ) + ->caller( __METHOD__ )->fetchResultSet(); $this->output( " processing..." ); if ( $res->numRows() ) { |