(Bug 16678) localurl/fullurl for Media: titles should return the File: title's path
authorAaron Schulz <aaron@users.mediawiki.org>
Tue, 23 Dec 2008 21:12:43 +0000 (21:12 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Tue, 23 Dec 2008 21:12:43 +0000 (21:12 +0000)
includes/parser/CoreParserFunctions.php

index 05b4fe9..a3b5189 100644 (file)
@@ -126,8 +126,12 @@ class CoreParserFunctions {
                # attempt, url-decode and try for a second.
                if( is_null( $title ) )
                        $title = Title::newFromUrl( urldecode( $s ) );
-               if ( !is_null( $title ) ) {
-                       if ( !is_null( $arg ) ) {
+               if( !is_null( $title ) ) {
+                       # Convert NS_MEDIA -> NS_FILE
+                       if( $title->getNamespace() == NS_MEDIA ) {
+                               $title = Title::makeTitle( NS_FILE, $title->getDBKey() );
+                       }
+                       if( !is_null( $arg ) ) {
                                $text = $title->$func( $arg );
                        } else {
                                $text = $title->$func();