From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- includes/filerepo/ForeignAPIFile.php | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'includes/filerepo/ForeignAPIFile.php') diff --git a/includes/filerepo/ForeignAPIFile.php b/includes/filerepo/ForeignAPIFile.php index 56fed75e..53c4a3bd 100644 --- a/includes/filerepo/ForeignAPIFile.php +++ b/includes/filerepo/ForeignAPIFile.php @@ -15,7 +15,13 @@ class ForeignAPIFile extends File { private $mExists; - + + /** + * @param $title + * @param $repo ForeignApiRepo + * @param $info + * @param bool $exists + */ function __construct( $title, $repo, $info, $exists = false ) { parent::__construct( $title, $repo ); $this->mInfo = $info; @@ -23,7 +29,6 @@ class ForeignAPIFile extends File { } /** - * @static * @param $title Title * @param $repo ForeignApiRepo * @return ForeignAPIFile|null @@ -32,7 +37,9 @@ class ForeignAPIFile extends File { $data = $repo->fetchImageQuery( array( 'titles' => 'File:' . $title->getDBKey(), 'iiprop' => self::getProps(), - 'prop' => 'imageinfo' ) ); + 'prop' => 'imageinfo', + 'iimetadataversion' => MediaHandler::getMetadataVersion() + ) ); $info = $repo->getImageInfo( $data ); @@ -76,20 +83,26 @@ class ForeignAPIFile extends File { // show icon return parent::transform( $params, $flags ); } + + // Note, the this->canRender() check above implies + // that we have a handler, and it can do makeParamString. + $otherParams = $this->handler->makeParamString( $params ); + $thumbUrl = $this->repo->getThumbUrlFromCache( $this->getName(), isset( $params['width'] ) ? $params['width'] : -1, - isset( $params['height'] ) ? $params['height'] : -1 ); + isset( $params['height'] ) ? $params['height'] : -1, + $otherParams ); return $this->handler->getTransform( $this, 'bogus', $thumbUrl, $params ); } // Info we can get from API... public function getWidth( $page = 1 ) { - return intval( @$this->mInfo['width'] ); + return isset( $this->mInfo['width'] ) ? intval( $this->mInfo['width'] ) : 0; } public function getHeight( $page = 1 ) { - return intval( @$this->mInfo['height'] ); + return isset( $this->mInfo['height'] ) ? intval( $this->mInfo['height'] ) : 0; } public function getMetadata() { @@ -148,7 +161,7 @@ class ForeignAPIFile extends File { return $this->mInfo['mime']; } - /// @todo Fixme: may guess wrong on file types that can be eg audio or video + /// @todo FIXME: May guess wrong on file types that can be eg audio or video function getMediaType() { $magic = MimeMagic::singleton(); return $magic->getMediaType( null, $this->getMimeType() ); @@ -182,7 +195,7 @@ class ForeignAPIFile extends File { $handle = opendir( $dir ); if ( $handle ) { while ( false !== ( $file = readdir($handle) ) ) { - if ( $file{0} != '.' ) { + if ( $file[0] != '.' ) { $files[] = $file; } } -- cgit v1.2.3-54-g00ecf