From a30d4319a57cdf118e0d77162a4f8ca2dff9eab7 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Tue, 3 Aug 2010 20:50:31 +0000 Subject: [PATCH] Sort pages in categories without namespace prefix This removes $wgCategoryPrefixedDefaultSortkey and effectively always makes it false. The setting was added in the first place to hack around the default, clearly broken behavior, but this just fixes it instead, so the setting is no longer needed. Running maintenance/updateCollation.php for the first time will fix this, no need to run refreshLinks.php. If you've already run updateCollation.php, you can do UPDATE categorylinks SET cl_collation = 76; or such and then run the script again. --- RELEASE-NOTES | 2 ++ includes/DefaultSettings.php | 6 ------ includes/Title.php | 8 +------- maintenance/updateCollation.php | 3 ++- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 943525a29c..df7ffc975e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -48,6 +48,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN normal $wgDBport. * The upload link for missing files can now be set separately from the navigation link with $wgUploadMissingFileUrl. +* $wgCategoryPrefixedDefaultSortkey was removed and is now always false. This + provides more sensible sorting behavior for categories. === New features in 1.17 === * (bug 10183) Users can now add personal styles and scripts to all skins via diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 91914026bc..9ba549efec 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4466,12 +4466,6 @@ $wgCategoryMagicGallery = true; */ $wgCategoryPagingLimit = 200; -/** - * Should the default category sortkey be the prefixed title? - * Run maintenance/refreshLinks.php after changing this. - */ -$wgCategoryPrefixedDefaultSortkey = true; - /** * A version indicator for collations that will be stored in cl_collation for * all new rows. Used when the collation algorithm changes: a script checks diff --git a/includes/Title.php b/includes/Title.php index b3b7bce6ff..b2718197b6 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -4149,13 +4149,7 @@ class Title { * @return string */ public function getCategorySortkey( $prefix = '' ) { - global $wgCategoryPrefixedDefaultSortkey; - if ( $this->getNamespace() == NS_CATEGORY - || !$wgCategoryPrefixedDefaultSortkey ) { - $unprefixed = $this->getText(); - } else { - $unprefixed = $this->getPrefixedText(); - } + $unprefixed = $this->getText(); if ( $prefix !== '' ) { # Separate with a null byte, so the unprefixed part is only used as # a tiebreaker when two pages have the exact same prefix -- null diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index c41d95c05c..0bc40ecf85 100644 --- a/maintenance/updateCollation.php +++ b/maintenance/updateCollation.php @@ -60,7 +60,8 @@ TEXT; if ( $row->cl_collation == 0 ) { # This is an old-style row, so the sortkey needs to be # converted. - if ( $row->cl_sortkey == $title->getCategorySortkey() ) { + if ( $row->cl_sortkey == $title->getText() + || $row->cl_sortkey == $title->getPrefixedText() ) { $prefix = ''; } else { # Custom sortkey, use it as a prefix -- 2.20.1