Sort pages in categories without namespace prefix
authorAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 3 Aug 2010 20:50:31 +0000 (20:50 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 3 Aug 2010 20:50:31 +0000 (20:50 +0000)
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
includes/DefaultSettings.php
includes/Title.php
maintenance/updateCollation.php

index 943525a..df7ffc9 100644 (file)
@@ -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
index 9191402..9ba549e 100644 (file)
@@ -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
index b3b7bce..b271819 100644 (file)
@@ -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
index c41d95c..0bc40ec 100644 (file)
@@ -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