jenkins-bot has submitted this change and it was merged.
Change subject: Update categorylinks.cl_type when moving a page
......................................................................
Update categorylinks.cl_type when moving a page
cl_type might need to be changed if the page was moved between
special-cased namespaces (Category ↔ File ↔ (other)).
Also update cl_collation, which also might have changed in the
meantime.
Bug: 69740
Change-Id: I46032a8ba04d77005731c02680f77a8808974087
---
M includes/Title.php
1 file changed, 12 insertions(+), 1 deletion(-)
Approvals:
Brian Wolff: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Title.php b/includes/Title.php
index ca292ee..7959860 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -3748,7 +3748,7 @@
* @return array|bool True on success, getUserPermissionsErrors()-like
array on failure
*/
public function moveTo( &$nt, $auth = true, $reason = '',
$createRedirect = true ) {
- global $wgUser;
+ global $wgUser, $wgCategoryCollation;
$err = $this->isValidMoveOperation( $nt, $auth, $reason );
if ( is_array( $err ) ) {
// Auto-block user's IP if the account was "hard"
blocked
@@ -3787,12 +3787,21 @@
// Refresh the sortkey for this row. Be careful to avoid
resetting
// cl_timestamp, which may disturb time-based lists on some
sites.
+ // @todo This block should be killed, it's duplicating code
+ // from LinksUpdate::getCategoryInsertions() and friends.
$prefixes = $dbw->select(
'categorylinks',
array( 'cl_sortkey_prefix', 'cl_to' ),
array( 'cl_from' => $pageid ),
__METHOD__
);
+ if ( $nt->getNamespace() == NS_CATEGORY ) {
+ $type = 'subcat';
+ } elseif ( $nt->getNamespace() == NS_FILE ) {
+ $type = 'file';
+ } else {
+ $type = 'page';
+ }
foreach ( $prefixes as $prefixRow ) {
$prefix = $prefixRow->cl_sortkey_prefix;
$catTo = $prefixRow->cl_to;
@@ -3800,6 +3809,8 @@
array(
'cl_sortkey' =>
Collation::singleton()->getSortKey(
$nt->getCategorySortkey(
$prefix ) ),
+ 'cl_collation' => $wgCategoryCollation,
+ 'cl_type' => $type,
'cl_timestamp=cl_timestamp' ),
array(
'cl_from' => $pageid,
--
To view, visit https://gerrit.wikimedia.org/r/158876
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I46032a8ba04d77005731c02680f77a8808974087
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: MZMcBride <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: PleaseStand <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits