summaryrefslogtreecommitdiff
path: root/includes/filerepo/ForeignAPIFile.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-06-10 13:00:47 +0200
committerPierre Schmitz <pierre@archlinux.de>2009-06-10 13:00:47 +0200
commit72e90545454c0e014318fa3c81658e035aac58c1 (patch)
tree9212e3f46868989c4d57ae9a5c8a1a80e4dc0702 /includes/filerepo/ForeignAPIFile.php
parent565a0ccc371ec1a2a0e9b39487cbac18e6f60e25 (diff)
applying patch to version 1.15.0
Diffstat (limited to 'includes/filerepo/ForeignAPIFile.php')
-rw-r--r--includes/filerepo/ForeignAPIFile.php26
1 files changed, 20 insertions, 6 deletions
diff --git a/includes/filerepo/ForeignAPIFile.php b/includes/filerepo/ForeignAPIFile.php
index d9fb85d0..03498fb1 100644
--- a/includes/filerepo/ForeignAPIFile.php
+++ b/includes/filerepo/ForeignAPIFile.php
@@ -59,7 +59,21 @@ class ForeignAPIFile extends File {
}
public function getMetadata() {
- return serialize( (array)@$this->mInfo['metadata'] );
+ if ( isset( $this->mInfo['metadata'] ) ) {
+ return serialize( self::parseMetadata( $this->mInfo['metadata'] ) );
+ }
+ return null;
+ }
+
+ public static function parseMetadata( $metadata ) {
+ if( !is_array( $metadata ) ) {
+ return $metadata;
+ }
+ $ret = array();
+ foreach( $metadata as $meta ) {
+ $ret[ $meta['name'] ] = self::parseMetadata( $meta['value'] );
+ }
+ return $ret;
}
public function getSize() {
@@ -87,11 +101,11 @@ class ForeignAPIFile extends File {
}
function getMimeType() {
- if( empty( $info['mime'] ) ) {
+ if( !isset( $this->mInfo['mime'] ) ) {
$magic = MimeMagic::singleton();
- $info['mime'] = $magic->guessTypesForExtension( $this->getExtension() );
+ $this->mInfo['mime'] = $magic->guessTypesForExtension( $this->getExtension() );
}
- return $info['mime'];
+ return $this->mInfo['mime'];
}
/// @fixme May guess wrong on file types that can be eg audio or video
@@ -146,8 +160,8 @@ class ForeignAPIFile extends File {
}
function purgeDescriptionPage() {
- global $wgMemc;
- $url = $this->repo->getDescriptionRenderUrl( $this->getName() );
+ global $wgMemc, $wgContLang;
+ $url = $this->repo->getDescriptionRenderUrl( $this->getName(), $wgContLang->getCode() );
$key = wfMemcKey( 'RemoteFileDescription', 'url', md5($url) );
$wgMemc->delete( $key );
}