From: Roan Kattouw Date: Tue, 5 May 2009 09:47:53 +0000 (+0000) Subject: Fix up r47473: descend into subarrays in ForeignAPIFile::getMetadata() X-Git-Tag: 1.31.0-rc.0~41875 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=a8dc3d7221e85699e7db4ad56fd2d7863b872512;p=lhc%2Fweb%2Fwiklou.git Fix up r47473: descend into subarrays in ForeignAPIFile::getMetadata() --- diff --git a/includes/filerepo/ForeignAPIFile.php b/includes/filerepo/ForeignAPIFile.php index 0a29367618..03498fb115 100644 --- a/includes/filerepo/ForeignAPIFile.php +++ b/includes/filerepo/ForeignAPIFile.php @@ -60,15 +60,22 @@ class ForeignAPIFile extends File { public function getMetadata() { if ( isset( $this->mInfo['metadata'] ) ) { - $ret = array(); - foreach( $this->mInfo['metadata'] as $meta ) { - $ret[ $meta['name'] ] = $meta['value']; - } - return serialize( $ret ); + 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() { return intval( @$this->mInfo['size'] ); }