* (bug 10132, 10134) Restore back-compatibility Image::imageUrl() function
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 4 Jun 2007 15:22:37 +0000 (15:22 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 4 Jun 2007 15:22:37 +0000 (15:22 +0000)
RELEASE-NOTES
includes/filerepo/LocalFile.php

index 1810ba8..2c20d30 100644 (file)
@@ -108,6 +108,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Add Google Wireless Transcoder to the Unicode editing blacklist
 * (bug 10083) Fix for Special:Version breakage on PHP 5.2 with some hooks
 * (bug 3624) TeX: \ker, \hom, \arg, \dim treated like \sin & \cos
+* (bug 10132, 10134) Restore back-compatibility Image::imageUrl() function
 
 
 == MediaWiki API changes since 1.10 ==
index 87542ca..cd0a331 100644 (file)
@@ -1330,6 +1330,7 @@ class Image extends LocalFile {
        /**
         * Wrapper for wfFindFile(), for backwards-compatibility only
         * Do not use in core code.
+        * @deprecated
         */
        function newFromTitle( $title, $time = false ) {
                $img = wfFindFile( $title, $time );
@@ -1338,6 +1339,29 @@ class Image extends LocalFile {
                }
                return $img;
        }
+       
+       /**
+        * Return the URL of an image, provided its name.
+        *
+        * Backwards-compatibility for extensions.
+        * Note that fromSharedDirectory will only use the shared path for files
+        * that actually exist there now, and will return local paths otherwise.
+        *
+        * @param string $name  Name of the image, without the leading "Image:"
+        * @param boolean $fromSharedDirectory  Should this be in $wgSharedUploadPath?
+        * @return string URL of $name image
+        * @deprecated
+        */
+       static function imageUrl( $name, $fromSharedDirectory = false ) {
+               $image = null;
+               if( $fromSharedDirectory ) {
+                       $image = wfFindFile( $name );
+               }
+               if( !$image ) {
+                       $image = wfLocalFile( $name );
+               }
+               return $image->getUrl();
+       }
 }
 
 /**