Alias NS_MEDIA page views to NS_FILE. Fixes bug 32032.
authorAaron Schulz <aaron@users.mediawiki.org>
Wed, 2 Nov 2011 18:47:04 +0000 (18:47 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Wed, 2 Nov 2011 18:47:04 +0000 (18:47 +0000)
includes/Wiki.php

index 7e2044a..9743478 100644 (file)
@@ -78,7 +78,12 @@ class MediaWiki {
                        $ret = Title::newMainPage();
                } else {
                        $ret = Title::newFromURL( $title );
-                       // check variant links so that interwiki links don't have to worry
+                       // Alias NS_MEDIA page URLs to NS_FILE...we only use NS_MEDIA
+                       // in wikitext links to tell Parser to make a direct file link
+                       if ( !is_null( $ret ) && $ret->getNamespace() == NS_MEDIA ) {
+                               $ret = Title::makeTitle( NS_FILE, $ret->getDBkey() );
+                       }
+                       // Check variant links so that interwiki links don't have to worry
                        // about the possible different language variants
                        if ( count( $wgContLang->getVariants() ) > 1
                                && !is_null( $ret ) && $ret->getArticleID() == 0 )