From c70b23a6bb4cffd1fc1c4b9d27bff25fb7df80f6 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 25 Mar 2009 08:46:22 +0000 Subject: [PATCH] Revert r47530 "Fix bug 17571, now page1 would add to both cat1 and cat2." Code is unclear; needs cleanup before adding more instances of this :D --- includes/LinksUpdate.php | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/includes/LinksUpdate.php b/includes/LinksUpdate.php index 0ffeb370ff..d1ac429318 100644 --- a/includes/LinksUpdate.php +++ b/includes/LinksUpdate.php @@ -428,25 +428,18 @@ class LinksUpdate { function getCategoryInsertions( $existing = array() ) { global $wgContLang; $diffs = array_diff_assoc( $this->mCategories, $existing ); - foreach ( $this->mCategories as $name => $sortkey ) { - $newname = $name; - $nt = Title::makeTitleSafe( NS_CATEGORY, $newname ); - $wgContLang->findVariantLink( $newname, $nt, true ); + $arr = array(); + foreach ( $diffs as $name => $sortkey ) { + $nt = Title::makeTitleSafe( NS_CATEGORY, $name ); + $wgContLang->findVariantLink( $name, $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 ( ! array_key_exists( $newname, $existing ) - and $nt->getNamespace() == NS_CATEGORY ) - $diffs[$newname] = $sortkey; + if ( $nt->getNamespace() == NS_CATEGORY ) + $name = $nt->getText(); } - } - $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, -- 2.20.1