* @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;
}
$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 ) {