From: jenkins-bot Date: Mon, 26 Feb 2018 19:15:56 +0000 (+0000) Subject: Merge "updateCollation.php: Improve --dry-run mode" X-Git-Tag: 1.31.0-rc.0~505 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=4b2f95bed5a9ae0a917264abed2ba1fd9fb78f3c;hp=1797b20c8e675d92594be2a6b0c2f319f11026b0;p=lhc%2Fweb%2Fwiklou.git Merge "updateCollation.php: Improve --dry-run mode" --- diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index 63176cb6ef..54ae1301f1 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,8 +227,11 @@ TEXT $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 ... " ); @@ -232,7 +240,9 @@ TEXT } } 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" );