(bug 3311) Automatic category redirects
authorPhilip Tzou <philip@users.mediawiki.org>
Mon, 2 Feb 2009 14:15:21 +0000 (14:15 +0000)
committerPhilip Tzou <philip@users.mediawiki.org>
Mon, 2 Feb 2009 14:15:21 +0000 (14:15 +0000)
RELEASE-NOTES
includes/LinksUpdate.php

index 603373a..1df6f30 100644 (file)
@@ -78,6 +78,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   for a given title.
 * Styled #mw-data-after-content in cologneblue.css to match the rest of the font (bug 17110)
 * (bug 7556) Time zone names in signatures lack i18n
+* (bug 3311) Automatic category redirects
 
 === Bug fixes in 1.15 ===
 * (bug 16968) Special:Upload no longer throws useless warnings.
index d0abf2f..d3468f3 100644 (file)
@@ -471,6 +471,14 @@ class LinksUpdate {
                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();
+                               // we only redirect a category to another category
+                               if ( $nt->getNamespace() == NS_CATEGORY )
+                                       $name = $nt->getText();
+                       }
                        $arr[] = array(
                                'cl_from'    => $this->mId,
                                'cl_to'      => $name,