r81171 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81170‎ | r81171 | r81172 >
Date:22:27, 28 January 2011
Author:platonides
Status:ok
Tags:
Comment:
Update comments to take into account r80443 and r80614 changes, per CR.
Modified paths:
  • /trunk/phase3/includes/Collation.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -4152,9 +4152,10 @@
41534153 public function getCategorySortkey( $prefix = '' ) {
41544154 $unprefixed = $this->getText();
41554155 if ( $prefix !== '' ) {
4156 - # Separate with a null byte, so the unprefixed part is only used as
4157 - # a tiebreaker when two pages have the exact same prefix -- null
4158 - # sorts before everything else (hopefully).
 4156+ # Separate with a line feed, so the unprefixed part is only used as
 4157+ # a tiebreaker when two pages have the exact same prefix.
 4158+ # In UCA, tab is the only character that can sort above LF
 4159+ # so we strip both of them from the original prefix.
41594160 $prefix = strtr( $prefix, "\n\t", ' ' );
41604161 return "$prefix\n$unprefixed";
41614162 }
Index: trunk/phase3/includes/Collation.php
@@ -26,7 +26,7 @@
2727 * Given a string, convert it to a (hopefully short) key that can be used
2828 * for efficient sorting. A binary sort according to the sortkeys
2929 * corresponds to a logical sort of the corresponding strings. Current
30 - * code expects that a null character should sort before all others, but
 30+ * code expects that a line feed character should sort before all others, but
3131 * has no other particular expectations (and that one can be changed if
3232 * necessary).
3333 *
@@ -130,6 +130,9 @@
131131 }
132132
133133 function getSortKey( $string ) {
 134+ // intl extension produces non null-terminated
 135+ // strings. Appending '' fixes it so that it doesn't generate
 136+ // a warning on each access in debug php.
134137 wfSuppressWarnings();
135138 $key = $this->mainCollator->getSortKey( $string ) . '';
136139 wfRestoreWarnings();

Follow-up revisions

RevisionCommit summaryAuthorDate
r814021.17: MFT r79915, r79957, r79964, r79990, r80687, r80999, r81006, r81011, r81...catrope16:18, 2 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r80443* Introduced a non-dummy collation for $wgCategoryCollation, namely UCA with ...tstarling14:02, 17 January 2011
r80614In getCategorySortkey: strip tabs and line feeds from the user-supplied categ...tstarling05:18, 20 January 2011

Status & tagging log