Move WikiMap class from CentralAuth to core, since it's used in 2 extensions at least...
[lhc/web/wiklou.git] / includes / LinksUpdate.php
index 0ffeb37..d1ac429 100644 (file)
@@ -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,