$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',
[
[ 'cl_from' => $row->cl_from, 'cl_to' => $row->cl_to ],
__METHOD__
);
+ $count++;
}
if ( $row ) {
$batchConds = [ $this->getBatchCondition( $row, $dbw ) ];
$this->commitTransaction( $dbw, __METHOD__ );
}
- $count += $res->numRows();
- $this->output( "$count done.\n" );
+ if ( $dryRun ) {
+ $this->output( "$count rows would be updated so far.\n" );
+ } else {
+ $this->output( "$count done.\n" );
+ }
if ( !$dryRun && ++$batchCount % self::SYNC_INTERVAL == 0 ) {
$this->output( "Waiting for replica DBs ... " );
}
} 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" );