Index: trunk/phase3/includes/Title.php |
— | — | @@ -3026,6 +3026,8 @@ |
3027 | 3027 | * @return \type{\mixed} true on success, getUserPermissionsErrors()-like array on failure |
3028 | 3028 | */ |
3029 | 3029 | public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true ) { |
| 3030 | + global $wgContLang; |
| 3031 | + |
3030 | 3032 | $err = $this->isValidMoveOperation( $nt, $auth, $reason ); |
3031 | 3033 | if ( is_array( $err ) ) { |
3032 | 3034 | return $err; |
— | — | @@ -3058,24 +3060,19 @@ |
3059 | 3061 | } |
3060 | 3062 | $redirid = $this->getArticleID(); |
3061 | 3063 | |
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 | + ); |
3073 | 3072 | $dbw->update( 'categorylinks', |
3074 | 3073 | array( |
3075 | | - 'cl_sortkey' => $nt->getPrefixedText(), |
| 3074 | + 'cl_sortkey' => $wgContLang->convertToSortkey( $nt->getCategorySortkey( $prefix ) ), |
3076 | 3075 | 'cl_timestamp=cl_timestamp' ), |
3077 | | - array( |
3078 | | - 'cl_from' => $pageid, |
3079 | | - 'cl_sortkey' => $this->getPrefixedText() ), |
| 3076 | + array( 'cl_from' => $pageid ), |
3080 | 3077 | __METHOD__ ); |
3081 | 3078 | |
3082 | 3079 | if ( $protected ) { |