MediaWiki r38992 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r38991‎ | r38992 (on ViewVC)‎ | r38993 >
Date:11:19, 9 August 2008
Author:leon
Status:old
Tags:
Comment:
(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.
Modified paths:

Diff [purge]

Index: trunk/phase3/CREDITS
===================================================================
--- trunk/phase3/CREDITS	(revision 38991)
+++ trunk/phase3/CREDITS	(revision 38992)
@@ -11,6 +11,7 @@
 * Daniel Friesen
 * Greg Sabino Mullane
 * Hojjat
+* Leon Weber
 * Mohamed Magdy
 * Raimond Spekking
 * Roan Kattouw
@@ -20,8 +21,9 @@
 * Tim Starling
 
 == Patch Contributors ==
+* Daniel Arnold
+* Max Semenik
 * RememberTheDot
-* Max Semenik
 
 == Translators ==
 * Anders Wegge Jakobsen
Index: trunk/phase3/includes/parser/Parser.php
===================================================================
--- trunk/phase3/includes/parser/Parser.php	(revision 38991)
+++ trunk/phase3/includes/parser/Parser.php	(revision 38992)
@@ -4831,12 +4831,14 @@
 	 * @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();
 		}
 	}
 
Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 38991)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 38992)
@@ -2481,6 +2481,12 @@
 $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: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 38991)
+++ trunk/phase3/RELEASE-NOTES	(revision 38992)
@@ -87,6 +87,8 @@
   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 ===
 

Status & tagging log

  • 15:29, 12 September 2011 Meno25 (Talk | contribs) changed the status of r38992 [removed: ok added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox