Revert r44185, r44186 -- "Foreign repos (API or DB) now fetch images and/or descripti...
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 3 Dec 2008 23:49:04 +0000 (23:49 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 3 Dec 2008 23:49:04 +0000 (23:49 +0000)
The canonical-canonical 'Image' namespace name should always be used here for compatibility; an extra configuration option is unnecessary and adds confusion.

RELEASE-NOTES
includes/filerepo/FileRepo.php
includes/filerepo/ForeignAPIRepo.php

index a2c204c..0e1acd1 100644 (file)
@@ -386,10 +386,6 @@ The following extensions are migrated into MediaWiki 1.14:
 * (bug 16026) 'Revision-info' and 'revision-info-current' both accept wiki 
   markup now.
 * (bug 16529) Fix for search suggestions with some third-party JS libraries
-* Foreign repositories (API or DB) would fail to fetch images and/or description
-  pages if the repo wiki had a different canonical name for the File: namespace.
-  Added 'fileNamespace' configuration item to $wgForeignFileRepos to override
-  the local canonical name 'File' with another string.
 * (bug 13342) importScript() generates more consistent URI encoding
 
 
index 1649f1f..6208976 100644 (file)
@@ -15,7 +15,7 @@ abstract class FileRepo {
        var $thumbScriptUrl, $transformVia404;
        var $descBaseUrl, $scriptDirUrl, $articleUrl, $fetchDescription, $initialCapital;
        var $pathDisclosureProtection = 'paranoid';
-       var $descriptionCacheExpiry, $apiThumbCacheExpiry, $hashLevels, $fileNamespace;
+       var $descriptionCacheExpiry, $apiThumbCacheExpiry, $hashLevels;
 
        /**
         * Factory functions for creating new files
@@ -30,10 +30,9 @@ abstract class FileRepo {
 
                // Optional settings
                $this->initialCapital = true; // by default
-               $this->fileNamespace  = MWNamespace::getCanonicalName( NS_FILE ); // fallback to 'File'
                foreach ( array( 'descBaseUrl', 'scriptDirUrl', 'articleUrl', 'fetchDescription',
                        'thumbScriptUrl', 'initialCapital', 'pathDisclosureProtection', 
-                       'descriptionCacheExpiry', 'apiThumbCacheExpiry', 'hashLevels', 'fileNamespace' ) as $var )
+                       'descriptionCacheExpiry', 'apiThumbCacheExpiry', 'hashLevels' ) as $var )
                {
                        if ( isset( $info[$var] ) ) {
                                $this->$var = $info[$var];
@@ -263,10 +262,10 @@ abstract class FileRepo {
                if ( is_null( $this->descBaseUrl ) ) {
                        if ( !is_null( $this->articleUrl ) ) {
                                $this->descBaseUrl = str_replace( '$1',
-                                       wfUrlencode( $this->getFileNamespace() ) . ':', $this->articleUrl );
+                                       wfUrlencode( MWNamespace::getCanonicalName( NS_FILE ) ) . ':', $this->articleUrl );
                        } elseif ( !is_null( $this->scriptDirUrl ) ) {
                                $this->descBaseUrl = $this->scriptDirUrl . '/index.php?title=' .
-                                       wfUrlencode( $this->getFileNamespace() ) . ':';
+                                       wfUrlencode( MWNamespace::getCanonicalName( NS_FILE ) ) . ':';
                        } else {
                                $this->descBaseUrl = false;
                        }
@@ -301,7 +300,7 @@ abstract class FileRepo {
        function getDescriptionRenderUrl( $name ) {
                if ( isset( $this->scriptDirUrl ) ) {
                        return $this->scriptDirUrl . '/index.php?title=' .
-                               wfUrlencode( $this->getFileNamespace() . ':' . $name ) .
+                               wfUrlencode( MWNamespace::getCanonicalName( NS_FILE ) . ':' . $name ) .
                                '&action=render';
                } else {
                        $descBase = $this->getDescBaseUrl();
@@ -535,11 +534,4 @@ abstract class FileRepo {
        function findBySha1( $hash ) {
                return array();
        }
-       /**
-        * Returns the file namespace string
-        * @return string
-        */
-       function getFileNamespace() {
-               return $this->fileNamespace;
-       }
 }
index fead30c..a6773e1 100644 (file)
@@ -94,7 +94,7 @@ class ForeignAPIRepo extends FileRepo {
        
        function getImageInfo( $title, $time = false ) {
                return $this->queryImage( array(
-                       'titles' => $this->getFileNamespace() . ':' . $title->getText(),
+                       'titles' => 'Image:' . $title->getText(),
                        'iiprop' => 'timestamp|user|comment|url|size|sha1|metadata|mime' ) );
        }