(bug 6387) Introduced new setting $wgCategoryPrefixedDefaultSortkey which
authorLeon Weber <leon@users.mediawiki.org>
Sat, 9 Aug 2008 11:19:18 +0000 (11:19 +0000)
committerLeon Weber <leon@users.mediawiki.org>
Sat, 9 Aug 2008 11:19:18 +0000 (11:19 +0000)
allows having the unprefixed page title as the default category sortkey.

Although creating sane defaults should always be preferred over introducing
new config options, we cannot just remove the old behaviour here, as some
peoply might still rely on it. However, the sortkey {{PAGENAME}} is already
widely used for circumventing the current behaviour.

CREDITS
RELEASE-NOTES
includes/DefaultSettings.php
includes/parser/Parser.php

diff --git a/CREDITS b/CREDITS
index 2ecc30f..5bc5a95 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -11,6 +11,7 @@ following names for their contribution to the product.
 * Daniel Friesen
 * Greg Sabino Mullane
 * Hojjat
+* Leon Weber
 * Mohamed Magdy
 * Raimond Spekking
 * Roan Kattouw
@@ -20,8 +21,9 @@ following names for their contribution to the product.
 * Tim Starling
 
 == Patch Contributors ==
-* RememberTheDot
+* Daniel Arnold
 * Max Semenik
+* RememberTheDot
 
 == Translators ==
 * Anders Wegge Jakobsen
index 3e8f038..2d6400c 100644 (file)
@@ -87,6 +87,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   in a div with class "templatesUsed"
 * (bug 14868) Setting $wgFeedDiffCutoff to 0 now disables generation of the diff
   entirely, not just the display of it.
+* (bug 6387) Introduced new setting $wgCategoryPrefixedDefaultSortkey which
+  allows having the unprefixed page title as the default category sortkey
 
 === API changes in 1.14 ===
 
index a9e3009..2b884f1 100644 (file)
@@ -2480,6 +2480,12 @@ $wgCategoryMagicGallery = true;
  */
 $wgCategoryPagingLimit = 200;
 
+/**
+ * Should the default category sortkey be the prefixed title?
+ * Run maintenance/refreshLinks.php after changing this.
+ */
+$wgCategoryPrefixedDefaultSortkey = true;
+
 /**
  * Browser Blacklist for unicode non compliant browsers
  * Contains a list of regexps : "/regexp/"  matching problematic browsers
index 7a2f5f7..b142924 100644 (file)
@@ -4831,12 +4831,14 @@ class Parser
         * @return string
         */
        public function getDefaultSort() {
+               global $wgCategoryPrefixedDefaultSortkey;
                if( $this->mDefaultSort !== false ) {
                        return $this->mDefaultSort;
+               } elseif ($this->mTitle->getNamespace() == NS_CATEGORY ||
+                       !$wgCategoryPrefixedDefaultSortkey) {
+                       return $this->mTitle->getText();
                } else {
-                       return $this->mTitle->getNamespace() == NS_CATEGORY
-                                       ? $this->mTitle->getText()
-                                       : $this->mTitle->getPrefixedText();
+                       return $this->mTitle->getPrefixedText();
                }
        }