From 8f821b654936c438c7256ce3b003f2faf5b5649d Mon Sep 17 00:00:00 2001 From: Leon Weber Date: Sat, 9 Aug 2008 11:19:18 +0000 Subject: [PATCH] (bug 6387) Introduced new setting $wgCategoryPrefixedDefaultSortkey which 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 | 4 +++- RELEASE-NOTES | 2 ++ includes/DefaultSettings.php | 6 ++++++ includes/parser/Parser.php | 8 +++++--- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CREDITS b/CREDITS index 2ecc30f98b..5bc5a95189 100644 --- 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 diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 3e8f038ab7..2d6400c40c 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index a9e300970f..2b884f1a49 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 7a2f5f7134..b142924483 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -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(); } } -- 2.20.1