From 52cc645480723d69afec39eb2f059114a2c77d99 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 12 Sep 2007 15:09:07 +0000 Subject: [PATCH] (bug 11308) Allow the API to output the image metadata Patch by Brian Tong Minh --- RELEASE-NOTES | 2 +- includes/api/ApiQueryImageInfo.php | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b56dda287c..700cb00881 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index da1a2d0c3f..61090957e3 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -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, -- 2.20.1