Fixing dry-run logic in updateCollation.php
authorKaldari <rkaldari@wikimedia.org>
Mon, 29 Aug 2016 23:29:24 +0000 (16:29 -0700)
committerKaldari <rkaldari@wikimedia.org>
Mon, 29 Aug 2016 23:29:24 +0000 (16:29 -0700)
Currently if you run updateCollation.php in dry-run mode, it ignores
the other parameters and doesn't give you a row estimate. Now it
will behave the same as an actual run (just without making any
changes to the database).

Change-Id: I25a9751d8ab7554e7975e5f08122dd1ddaaf40a7

maintenance/updateCollation.php

index 922cc87..930f533 100644 (file)
@@ -101,7 +101,7 @@ TEXT
                        'STRAIGHT_JOIN' // per T58041
                ];
 
-               if ( $force || $dryRun ) {
+               if ( $force ) {
                        $collationConds = [];
                } else {
                        if ( $this->hasOption( 'previous-collation' ) ) {
@@ -132,7 +132,11 @@ TEXT
 
                                return;
                        }
-                       $this->output( "Fixing collation for $count rows.\n" );
+                       if ( $dryRun ) {
+                               $this->output( "$count rows would be updated.\n" );
+                       } else {
+                               $this->output( "Fixing collation for $count rows.\n" );
+                       }
                        wfWaitForSlaves();
                }
                $count = 0;