X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FupdateCollation.php;h=19c1d24c7948a9858310a2bcc3dd5182ff90c150;hb=6acb48609409c794381e5c700b26aa5c77cec207;hp=964b3138d78be277193400ab292999b513844d3a;hpb=5c3fecdb372bbd96301a1c21d8fae3219c55a356;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index 964b3138d7..19c1d24c79 100644 --- a/maintenance/updateCollation.php +++ b/maintenance/updateCollation.php @@ -47,7 +47,7 @@ class UpdateCollation extends Maintenance { $this->mDescription = <<output( "Collations up-to-date.\n" ); + return; } $this->output( "Fixing collation for $count rows.\n" ); @@ -150,7 +151,8 @@ TEXT; # This is an old-style row, so the sortkey needs to be # converted. if ( $row->cl_sortkey == $title->getText() - || $row->cl_sortkey == $title->getPrefixedText() ) { + || $row->cl_sortkey == $title->getPrefixedText() + ) { $prefix = ''; } else { # Custom sortkey, use it as a prefix @@ -188,15 +190,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 +220,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; @@ -238,6 +238,7 @@ TEXT; $prefix .= " AND $equality"; } } + return $cond; }