From 41c35b3aa4a0e8f15550c30bcdbbb7255dd3a49e Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 6 Feb 2011 23:59:03 +0000 Subject: [PATCH] * (bug 27205) aiprop=metadata and aiprop=parsedcomment need help text Refactored code out to reduce duplication (and hence, mismatches like this) --- RELEASE-NOTES | 1 + includes/api/ApiQueryAllimages.php | 16 +--------------- includes/api/ApiQueryImageInfo.php | 25 ++++++++++++++++++------- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index fd06eebe3a..49c34b7f70 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -149,6 +149,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Expose list of skins in meta=siteinfo * (bug 26548) Add iiurlparam param to query=imageinfo and query=stashimageinfo * (bug 27201) Special:WhatLinksHere output no longer contains duplicate IDs +* (bug 27205) aiprop=metadata and aiprop=parsedcomment need help text === Languages updated in 1.18 === diff --git a/includes/api/ApiQueryAllimages.php b/includes/api/ApiQueryAllimages.php index 8fa733c698..52cea739e5 100644 --- a/includes/api/ApiQueryAllimages.php +++ b/includes/api/ApiQueryAllimages.php @@ -199,21 +199,7 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase { 'limit' => 'How many images in total to return', 'sha1' => "SHA1 hash of image. Overrides {$this->getModulePrefix()}sha1base36", 'sha1base36' => 'SHA1 hash of image in base 36 (used in MediaWiki)', - 'prop' => array( - 'Which properties to get', - ' timestamp - Adds the timestamp when the image was upload', - ' user - Adds the username of the last uploader', - ' userid - Adds the user ID of the last uploader', - ' comment - Adds the comment of the last upload', - ' url - Adds the URL of the image and its description page', - ' size - Adds the size of the image in bytes and its height and width', - ' dimensions - Alias of size', - ' sha1 - Adds the SHA-1 hash of the image', - ' mime - Adds the MIME of the image', - ' thumbmime - Adds the MIME of the tumbnail for the image', - ' archivename - Adds the file name of the archive version for non-latest versions', - ' bitdepth - Adds the bit depth of the version', - ), + 'prop' => ApiQueryImageInfo::getPropertyDescriptions(), ); } diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index 355d172504..836f363a09 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -424,6 +424,8 @@ class ApiQueryImageInfo extends ApiQueryBase { /** * Returns all possible parameters to iiprop + * @static + * @return Array */ public static function getPropertyNames() { return array( @@ -444,15 +446,14 @@ class ApiQueryImageInfo extends ApiQueryBase { ); } - /** - * Return the API documentation for the parameters. - * @return {Array} parameter documentation. + * Returns the descriptions for the properties provided by getPropertyNames() + * + * @static + * @return array */ - public function getParamDescription() { - $p = $this->getModulePrefix(); + public static function getPropertyDescriptions() { return array( - 'prop' => array( 'What image information to get:', ' timestamp - Adds timestamp for the uploaded version', ' user - Adds the user who uploaded the image version', @@ -468,7 +469,17 @@ class ApiQueryImageInfo extends ApiQueryBase { ' metadata - Lists EXIF metadata for the version of the image', ' archivename - Adds the file name of the archive version for non-latest versions', ' bitdepth - Adds the bit depth of the version', - ), + ); + } + + /** + * Return the API documentation for the parameters. + * @return {Array} parameter documentation. + */ + public function getParamDescription() { + $p = $this->getModulePrefix(); + return array( + 'prop' => self::getPropertyDescriptions(), 'urlwidth' => array( "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.", 'Only the current version of the image can be scaled' ), 'urlheight' => "Similar to {$p}urlwidth. Cannot be used without {$p}urlwidth", -- 2.20.1