From: Philip Tzou Date: Fri, 20 Feb 2009 06:47:03 +0000 (+0000) Subject: Fix bug 17571, now page1 would add to both cat1 and cat2. X-Git-Tag: 1.31.0-rc.0~42780 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=50970f42305f4bf233268769e3dc60cff7bb5aeb;p=lhc%2Fweb%2Fwiklou.git Fix bug 17571, now page1 would add to both cat1 and cat2. --- diff --git a/includes/LinksUpdate.php b/includes/LinksUpdate.php index 92856e9f42..0312250081 100644 --- a/includes/LinksUpdate.php +++ b/includes/LinksUpdate.php @@ -427,18 +427,25 @@ class LinksUpdate { function getCategoryInsertions( $existing = array() ) { global $wgContLang; $diffs = array_diff_assoc( $this->mCategories, $existing ); - $arr = array(); - foreach ( $diffs as $name => $sortkey ) { - $nt = Title::makeTitleSafe( NS_CATEGORY, $name ); - $wgContLang->findVariantLink( $name, $nt, true ); + foreach ( $this->mCategories as $name => $sortkey ) { + $newname = $name; + $nt = Title::makeTitleSafe( NS_CATEGORY, $newname ); + $wgContLang->findVariantLink( $newname, $nt, true ); // for category redirection if ( $nt->isRedirect() ) { $at = new Article( $nt ); $nt = $at->getRedirectTarget(); + $newname = $nt->getText(); // we only redirect a category to another category - if ( $nt->getNamespace() == NS_CATEGORY ) - $name = $nt->getText(); + if ( ! array_key_exists( $newname, $existing ) + and $nt->getNamespace() == NS_CATEGORY ) + $diffs[$newname] = $sortkey; } + } + $arr = array(); + foreach ( $diffs as $name => $sortkey ) { + $nt = Title::makeTitleSafe( NS_CATEGORY, $name ); + $wgContLang->findVariantLink( $name, $nt, true ); $arr[] = array( 'cl_from' => $this->mId, 'cl_to' => $name,