X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FupdateCollation.php;h=d88d5e968e56bdfbbc6bdaf62106e5ca52528585;hb=e9d42c0e7ea9390f650de8e350a4f64ff19787b0;hp=84fc2d208e03a12f5082ad80c271b3ea83903c87;hpb=dae4c94d893057345f62a3d498fb85c0a54de5a6;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index 84fc2d208e..d88d5e968e 100644 --- a/maintenance/updateCollation.php +++ b/maintenance/updateCollation.php @@ -200,7 +200,11 @@ TEXT $this->updateSortKeySizeHistogram( $newSortKey ); } - if ( !$dryRun ) { + if ( $dryRun ) { + // Add 1 to the count if the sortkey was changed. (Note that this doesn't count changes in + // other fields, if any, those usually only happen when upgrading old MediaWikis.) + $count += ( $row->cl_sortkey !== $newSortKey ); + } else { $dbw->update( 'categorylinks', [ @@ -213,6 +217,7 @@ TEXT [ 'cl_from' => $row->cl_from, 'cl_to' => $row->cl_to ], __METHOD__ ); + $count++; } if ( $row ) { $batchConds = [ $this->getBatchCondition( $row, $dbw ) ]; @@ -222,17 +227,16 @@ TEXT $this->commitTransaction( $dbw, __METHOD__ ); } - $count += $res->numRows(); - $this->output( "$count done.\n" ); - - if ( !$dryRun && ++$batchCount % self::SYNC_INTERVAL == 0 ) { - $this->output( "Waiting for replica DBs ... " ); - wfWaitForSlaves(); - $this->output( "done\n" ); + if ( $dryRun ) { + $this->output( "$count rows would be updated so far.\n" ); + } else { + $this->output( "$count done.\n" ); } } while ( $res->numRows() == self::BATCH_SIZE ); - $this->output( "$count rows processed\n" ); + if ( !$dryRun ) { + $this->output( "$count rows processed\n" ); + } if ( $verboseStats ) { $this->output( "\n" ); @@ -344,5 +348,5 @@ TEXT } } -$maintClass = "UpdateCollation"; +$maintClass = UpdateCollation::class; require_once RUN_MAINTENANCE_IF_MAIN;