r83866 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:< r83865‎ | r83866 | r83867 >
Date:02:19, 14 March 2011
Author:bawolff
Status:ok
Tags:
Comment:
(bug 28020) Moving pages causes the cl_sortkey thats appropriate for one of the categorylinks, to be set for all of them.
But the cl_sortkey_prefix are kept to the right value for the cl_sortkey's that are set to the wrong value, totally messing things up.

End result is: Have a page, with some categories having different sortkeys, move that page, now all the categories have the same
sortkey, but still have their original prefix, so linksupdate things the sortkey is correct. End result is null edits don't fix
the sortkey, nothing but removing and re-adding category will reset sortkey to correct value.
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
——@@ -3111,19 +3111,26 @@
31123112
31133113 // Refresh the sortkey for this row. Be careful to avoid resetting
31143114 // cl_timestamp, which may disturb time-based lists on some sites.
3115 - $prefix = $dbw->selectField(
 3115+ $prefixes = $dbw->select(
31163116 'categorylinks',
3117 - 'cl_sortkey_prefix',
 3117+ array( 'cl_sortkey_prefix', 'cl_to' ),
31183118 array( 'cl_from' => $pageid ),
31193119 __METHOD__
31203120 );
3121 - $dbw->update( 'categorylinks',
3122 - array(
3123 - 'cl_sortkey' => Collation::singleton()->getSortKey(
3124 - $nt->getCategorySortkey( $prefix ) ),
3125 - 'cl_timestamp=cl_timestamp' ),
3126 - array( 'cl_from' => $pageid ),
3127 - __METHOD__ );
 3121+ foreach ( $prefixes as $prefixRow ) {
 3122+ $prefix = $prefixRow->cl_sortkey_prefix;
 3123+ $catTo = $prefixRow->cl_to;
 3124+ $dbw->update( 'categorylinks',
 3125+ array(
 3126+ 'cl_sortkey' => Collation::singleton()->getSortKey(
 3127+ $nt->getCategorySortkey( $prefix ) ),
 3128+ 'cl_timestamp=cl_timestamp' ),
 3129+ array(
 3130+ 'cl_from' => $pageid,
 3131+ 'cl_to' => $catTo ),
 3132+ __METHOD__
 3133+ );
 3134+ }
31283135
31293136 if ( $protected ) {
31303137 # Protect the redirect title as the title used to be...

Follow-up revisions

RevisionCommit summaryAuthorDate
r839321.17wmf1: MFT r78990, r79844, r81548, r82022, r82193, r83061, r83067, r83583,...catrope17:59, 14 March 2011

Status & tagging log