http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70416

Revision: 70416
Author:   simetrical
Date:     2010-08-03 20:50:31 +0000 (Tue, 03 Aug 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/phase3/RELEASE-NOTES
    trunk/phase3/includes/DefaultSettings.php
    trunk/phase3/includes/Title.php
    trunk/phase3/maintenance/updateCollation.php

Modified: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES  2010-08-03 20:50:01 UTC (rev 70415)
+++ trunk/phase3/RELEASE-NOTES  2010-08-03 20:50:31 UTC (rev 70416)
@@ -48,6 +48,8 @@
   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

Modified: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php   2010-08-03 20:50:01 UTC (rev 
70415)
+++ trunk/phase3/includes/DefaultSettings.php   2010-08-03 20:50:31 UTC (rev 
70416)
@@ -4467,12 +4467,6 @@
 $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
  * for all rows where cl_collation != $wgCollationVersion and regenerates

Modified: trunk/phase3/includes/Title.php
===================================================================
--- trunk/phase3/includes/Title.php     2010-08-03 20:50:01 UTC (rev 70415)
+++ trunk/phase3/includes/Title.php     2010-08-03 20:50:31 UTC (rev 70416)
@@ -4149,13 +4149,7 @@
         * @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

Modified: trunk/phase3/maintenance/updateCollation.php
===================================================================
--- trunk/phase3/maintenance/updateCollation.php        2010-08-03 20:50:01 UTC 
(rev 70415)
+++ trunk/phase3/maintenance/updateCollation.php        2010-08-03 20:50:31 UTC 
(rev 70416)
@@ -60,7 +60,8 @@
                                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



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to