diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2014-12-27 15:41:37 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2014-12-31 11:43:28 +0100 |
commit | c1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch) | |
tree | 2b38796e738dd74cb42ecd9bfd151803108386bc /maintenance/updateCollation.php | |
parent | b88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff) |
Update to MediaWiki 1.24.1
Diffstat (limited to 'maintenance/updateCollation.php')
-rw-r--r-- | maintenance/updateCollation.php | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index 964b3138..342ffbad 100644 --- a/maintenance/updateCollation.php +++ b/maintenance/updateCollation.php @@ -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; @@ -120,6 +120,7 @@ TEXT; } if ( $count == 0 ) { $this->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" ); @@ -218,9 +219,11 @@ TEXT; /** * Return an SQL expression selecting rows which sort above the given row, * assuming an ordering of cl_to, cl_type, cl_from + * @param stdClass $row + * @param DatabaseBase $dbw + * @return string */ - 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 +241,7 @@ TEXT; $prefix .= " AND $equality"; } } + return $cond; } |