From a8dc3d7221e85699e7db4ad56fd2d7863b872512 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Tue, 5 May 2009 09:47:53 +0000 Subject: [PATCH] Fix up r47473: descend into subarrays in ForeignAPIFile::getMetadata() --- includes/filerepo/ForeignAPIFile.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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'] ); } -- 2.20.1