API:
[lhc/web/wiklou.git] / includes / api / ApiQueryImageInfo.php
index 7566f72..9d10263 100644 (file)
@@ -50,6 +50,8 @@ class ApiQueryImageInfo extends ApiQueryBase {
                $fld_comment = isset($prop['comment']);
                $fld_url = isset($prop['url']);
                $fld_size = isset($prop['size']);
+               $fld_sha1 = isset($prop['sha1']);
+               $fld_metadata = isset($prop['metadata']);
 
                $pageIds = $this->getPageSet()->getAllTitlesByNamespace();
                if (!empty($pageIds[NS_IMAGE])) {
@@ -87,6 +89,15 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                                        $vals['url'] = $isCur ? $img->getURL() : $img->getArchiveUrl($row["oi_archive_name"]);
                                                if ($fld_comment)
                                                        $vals['comment'] = $row["{$prefix}_description"];
+                                                       
+                                               if ($fld_sha1)
+                                                       $vals['sha1'] = wfBaseConvert($row["{$prefix}_sha1"], 36, 16, 40);
+                                                       
+                                               if ($fld_metadata) {
+                                                       $metadata = unserialize($row["{$prefix}_metadata"]);
+                                                       $vals['metadata'] = $metadata ? $metadata : null;
+                                                       $this->getResult()->setIndexedTagName_recursive($vals['metadata'], 'meta');                                                             
+                                               }
 
                                                $data[] = $vals;
                                                
@@ -119,6 +130,8 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                        'comment',
                                        'url',
                                        'size',
+                                       'sha1',
+                                       'metadata'
                                )
                        ),
                        'history' => false,