From: Aaron Schulz Date: Wed, 2 Nov 2011 18:47:04 +0000 (+0000) Subject: Alias NS_MEDIA page views to NS_FILE. Fixes bug 32032. X-Git-Tag: 1.31.0-rc.0~26755 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=8363693b77bc36b18d02cc2dc94e6c0ad3f7b0c8;p=lhc%2Fweb%2Fwiklou.git Alias NS_MEDIA page views to NS_FILE. Fixes bug 32032. --- diff --git a/includes/Wiki.php b/includes/Wiki.php index 7e2044a3f9..9743478219 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -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 )