Move reference to $row where it is in-scope and doesn't produce
authorMark A. Hershberger <mah@everybody.org>
Tue, 26 Nov 2013 03:08:23 +0000 (22:08 -0500)
committerMark A. Hershberger <mah@everybody.org>
Tue, 26 Nov 2013 03:18:55 +0000 (22:18 -0500)
E_STRICT notices.

Bug: 57575
Change-Id: Ic508ebbb0816acd32be355b5f19b46637d58c36a

maintenance/updateCollation.php

index 964b313..7ca04b4 100644 (file)
@@ -47,7 +47,7 @@ class UpdateCollation extends Maintenance {
                $this->mDescription = <<<TEXT
 This script will find all rows in the categorylinks table whose collation is
 out-of-date (cl_collation != '$wgCategoryCollation') and repopulate cl_sortkey
-using the page title and cl_sortkey_prefix.  If everything's collation is
+using the page title and cl_sortkey_prefix.  If all collations are
 up-to-date, it will do nothing.
 TEXT;
 
@@ -188,15 +188,14 @@ TEXT;
                                                __METHOD__
                                        );
                                }
+                               if ( $row ) {
+                                       $batchConds = array( $this->getBatchCondition( $row, $dbw ) );
+                               }
                        }
                        if ( !$dryRun ) {
                                $dbw->commit( __METHOD__ );
                        }
 
-                       if ( $row ) {
-                               $batchConds = array( $this->getBatchCondition( $row ) );
-                       }
-
                        $count += $res->numRows();
                        $this->output( "$count done.\n" );
 
@@ -219,8 +218,7 @@ TEXT;
         * Return an SQL expression selecting rows which sort above the given row,
         * assuming an ordering of cl_to, cl_type, cl_from
         */
-       function getBatchCondition( $row ) {
-               $dbw = $this->getDB( DB_MASTER );
+       function getBatchCondition( $row, $dbw ) {
                $fields = array( 'cl_to', 'cl_type', 'cl_from' );
                $first = true;
                $cond = false;