From: Aryeh Gregor Date: Tue, 3 Aug 2010 20:50:38 +0000 (+0000) Subject: Fix page moves with new category sort scheme X-Git-Tag: 1.31.0-rc.0~35749 X-Git-Url: http://git.cyclocoop.org/%27-%20%20.%20url_absolue%28find_in_path%28%27spip_style.css%27%29%29%20%20%20.%20url_absolue%28find_in_path%28%27prive/spip_style.css%27%29%29%20.%20%27?a=commitdiff_plain;h=5b05dc6951468387c60ef93bfe86cc3e2d58f474;p=lhc%2Fweb%2Fwiklou.git Fix page moves with new category sort scheme Some other things might have to be updated, like the API and extensions. --- diff --git a/includes/Title.php b/includes/Title.php index b2718197b6..e3760779cf 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -3026,6 +3026,8 @@ class Title { * @return \type{\mixed} true on success, getUserPermissionsErrors()-like array on failure */ public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true ) { + global $wgContLang; + $err = $this->isValidMoveOperation( $nt, $auth, $reason ); if ( is_array( $err ) ) { return $err; @@ -3058,24 +3060,19 @@ class Title { } $redirid = $this->getArticleID(); - // Category memberships include a sort key which may be customized. - // If it's left as the default (the page title), we need to update - // the sort key to match the new title. - // - // Be careful to avoid resetting cl_timestamp, which may disturb - // time-based lists on some sites. - // - // Warning -- if the sort key is *explicitly* set to the old title, - // we can't actually distinguish it from a default here, and it'll - // be set to the new title even though it really shouldn't. - // It'll get corrected on the next edit, but resetting cl_timestamp. + // Refresh the sortkey for this row. Be careful to avoid resetting + // cl_timestamp, which may disturb time-based lists on some sites. + $prefix = $dbw->selectField( + 'categorylinks', + 'cl_sortkey_prefix', + array( 'cl_from' => $pageid ), + __METHOD__ + ); $dbw->update( 'categorylinks', array( - 'cl_sortkey' => $nt->getPrefixedText(), + 'cl_sortkey' => $wgContLang->convertToSortkey( $nt->getCategorySortkey( $prefix ) ), 'cl_timestamp=cl_timestamp' ), - array( - 'cl_from' => $pageid, - 'cl_sortkey' => $this->getPrefixedText() ), + array( 'cl_from' => $pageid ), __METHOD__ ); if ( $protected ) {