r70416 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70415‎ | r70416 | r70417 >
Date:20:50, 3 August 2010
Author:simetrical
Status:ok (Comments)
Tags:
Comment:
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 (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/maintenance/updateCollation.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/updateCollation.php
@@ -60,7 +60,8 @@
6161 if ( $row->cl_collation == 0 ) {
6262 # This is an old-style row, so the sortkey needs to be
6363 # converted.
64 - if ( $row->cl_sortkey == $title->getCategorySortkey() ) {
 64+ if ( $row->cl_sortkey == $title->getText()
 65+ || $row->cl_sortkey == $title->getPrefixedText() ) {
6566 $prefix = '';
6667 } else {
6768 # Custom sortkey, use it as a prefix
Index: trunk/phase3/includes/Title.php
@@ -4149,13 +4149,7 @@
41504150 * @return string
41514151 */
41524152 public function getCategorySortkey( $prefix = '' ) {
4153 - global $wgCategoryPrefixedDefaultSortkey;
4154 - if ( $this->getNamespace() == NS_CATEGORY
4155 - || !$wgCategoryPrefixedDefaultSortkey ) {
4156 - $unprefixed = $this->getText();
4157 - } else {
4158 - $unprefixed = $this->getPrefixedText();
4159 - }
 4153+ $unprefixed = $this->getText();
41604154 if ( $prefix !== '' ) {
41614155 # Separate with a null byte, so the unprefixed part is only used as
41624156 # a tiebreaker when two pages have the exact same prefix -- null
Index: trunk/phase3/includes/DefaultSettings.php
@@ -4467,12 +4467,6 @@
44684468 $wgCategoryPagingLimit = 200;
44694469
44704470 /**
4471 - * Should the default category sortkey be the prefixed title?
4472 - * Run maintenance/refreshLinks.php after changing this.
4473 - */
4474 -$wgCategoryPrefixedDefaultSortkey = true;
4475 -
4476 -/**
44774471 * A version indicator for collations that will be stored in cl_collation for
44784472 * all new rows. Used when the collation algorithm changes: a script checks
44794473 * for all rows where cl_collation != $wgCollationVersion and regenerates
Index: trunk/phase3/RELEASE-NOTES
@@ -48,6 +48,8 @@
4949 normal $wgDBport.
5050 * The upload link for missing files can now be set separately from the
5151 navigation link with $wgUploadMissingFileUrl.
 52+* $wgCategoryPrefixedDefaultSortkey was removed and is now always false. This
 53+ provides more sensible sorting behavior for categories.
5254
5355 === New features in 1.17 ===
5456 * (bug 10183) Users can now add personal styles and scripts to all skins via

Comments

#Comment by Subfader (talk | contribs)   12:39, 2 July 2011

bad decision.

#Comment by Simetrical (talk | contribs)   16:53, 3 July 2011

Do you have any specific arguments or reasoning to support this comment? If not, you're welcome to your opinion, but I wouldn't expect it to get acted upon.

#Comment by Subfader (talk | contribs)   17:14, 3 July 2011

Yes: https://bugzilla.wikimedia.org/show_bug.cgi?id=29680

And no, I don't expect reactions here.

#Comment by MZMcBride (talk | contribs)   11:16, 15 April 2012

Follow-up to r38992.

Status & tagging log