(bug 11308) Allow the API to output the image metadata
authorRoan Kattouw <catrope@users.mediawiki.org>
Wed, 12 Sep 2007 15:09:07 +0000 (15:09 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Wed, 12 Sep 2007 15:09:07 +0000 (15:09 +0000)
Patch by Brian Tong Minh

RELEASE-NOTES
includes/api/ApiQueryImageInfo.php

index b56dda2..700cb00 100644 (file)
@@ -43,7 +43,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   editinterface to a new permission key editusercssjs.
 * (bug 11266) Set fallback language for Fulfulde (ff) to French
 * (bug 11179) Include image version deletion comment in public log
-* (bug 11158) Fix escaping in API HTML-formatted JSON
 * Fixed notice when accessing special page without read permission and whitelist
   is not defined
 * (bug 9252) Fix for tidy funkiness when using editintro mode
@@ -56,6 +55,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 Full API documentation is available at http://www.mediawiki.org/wiki/API
 
 * (bug 11275) Enable descending sort in categorymembers
+* (bug 11308) Allow the API to output the image metadata
 
 === Languages updated in 1.12 ===
 
index da1a2d0..6109095 100644 (file)
@@ -51,6 +51,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
                $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])) {
@@ -91,6 +92,11 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                                        
                                                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;
+                                               }
 
                                                $data[] = $vals;
                                                
@@ -123,7 +129,8 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                        'comment',
                                        'url',
                                        'size',
-                                       'sha1'
+                                       'sha1',
+                                       'metadata'
                                )
                        ),
                        'history' => false,