r70417 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70416‎ | r70417 | r70418 >
Date:20:50, 3 August 2010
Author:simetrical
Status:ok
Tags:
Comment:
Fix page moves with new category sort scheme

Some other things might have to be updated, like the API and extensions.
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -3026,6 +3026,8 @@
30273027 * @return \type{\mixed} true on success, getUserPermissionsErrors()-like array on failure
30283028 */
30293029 public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true ) {
 3030+ global $wgContLang;
 3031+
30303032 $err = $this->isValidMoveOperation( $nt, $auth, $reason );
30313033 if ( is_array( $err ) ) {
30323034 return $err;
@@ -3058,24 +3060,19 @@
30593061 }
30603062 $redirid = $this->getArticleID();
30613063
3062 - // Category memberships include a sort key which may be customized.
3063 - // If it's left as the default (the page title), we need to update
3064 - // the sort key to match the new title.
3065 - //
3066 - // Be careful to avoid resetting cl_timestamp, which may disturb
3067 - // time-based lists on some sites.
3068 - //
3069 - // Warning -- if the sort key is *explicitly* set to the old title,
3070 - // we can't actually distinguish it from a default here, and it'll
3071 - // be set to the new title even though it really shouldn't.
3072 - // It'll get corrected on the next edit, but resetting cl_timestamp.
 3064+ // Refresh the sortkey for this row. Be careful to avoid resetting
 3065+ // cl_timestamp, which may disturb time-based lists on some sites.
 3066+ $prefix = $dbw->selectField(
 3067+ 'categorylinks',
 3068+ 'cl_sortkey_prefix',
 3069+ array( 'cl_from' => $pageid ),
 3070+ __METHOD__
 3071+ );
30733072 $dbw->update( 'categorylinks',
30743073 array(
3075 - 'cl_sortkey' => $nt->getPrefixedText(),
 3074+ 'cl_sortkey' => $wgContLang->convertToSortkey( $nt->getCategorySortkey( $prefix ) ),
30763075 'cl_timestamp=cl_timestamp' ),
3077 - array(
3078 - 'cl_from' => $pageid,
3079 - 'cl_sortkey' => $this->getPrefixedText() ),
 3076+ array( 'cl_from' => $pageid ),
30803077 __METHOD__ );
30813078
30823079 if ( $protected ) {

Status & tagging log