Index: trunk/phase3/includes/filerepo/ForeignAPIFile.php |
— | — | @@ -60,15 +60,22 @@ |
61 | 61 | |
62 | 62 | public function getMetadata() { |
63 | 63 | if ( isset( $this->mInfo['metadata'] ) ) { |
64 | | - $ret = array(); |
65 | | - foreach( $this->mInfo['metadata'] as $meta ) { |
66 | | - $ret[ $meta['name'] ] = $meta['value']; |
67 | | - } |
68 | | - return serialize( $ret ); |
| 64 | + return serialize( self::parseMetadata( $this->mInfo['metadata'] ) ); |
69 | 65 | } |
70 | 66 | return null; |
71 | 67 | } |
72 | 68 | |
| 69 | + public static function parseMetadata( $metadata ) { |
| 70 | + if( !is_array( $metadata ) ) { |
| 71 | + return $metadata; |
| 72 | + } |
| 73 | + $ret = array(); |
| 74 | + foreach( $metadata as $meta ) { |
| 75 | + $ret[ $meta['name'] ] = self::parseMetadata( $meta['value'] ); |
| 76 | + } |
| 77 | + return $ret; |
| 78 | + } |
| 79 | + |
73 | 80 | public function getSize() { |
74 | 81 | return intval( @$this->mInfo['size'] ); |
75 | 82 | } |