From: Brion Vibber Date: Mon, 4 Jun 2007 15:22:37 +0000 (+0000) Subject: * (bug 10132, 10134) Restore back-compatibility Image::imageUrl() function X-Git-Tag: 1.31.0-rc.0~52695 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=e115a47d4c46a8214db907480dab8d0aee72a9ef;p=lhc%2Fweb%2Fwiklou.git * (bug 10132, 10134) Restore back-compatibility Image::imageUrl() function --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 1810ba864d..2c20d30375 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index 87542caa67..cd0a331ebd 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -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(); + } } /**