From 280355d209241389214a208960c7c0a8af886193 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Tue, 22 Mar 2011 00:08:45 +0000 Subject: [PATCH] * (bug 27586) Remove duplication of props in ApiQueryStashImageInfo by using ApiQueryImageInfo Programatically do properties and descriptions. Reduces text duplication, and hence normalises descriptions! :) Follows up r84502, r84433 --- RELEASE-NOTES | 2 ++ includes/api/ApiQueryStashImageInfo.php | 35 +++++-------------------- 2 files changed, 8 insertions(+), 29 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2886e8cf79..f72c505f66 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -277,6 +277,8 @@ PHP if you have not done so prior to upgrading MediaWiki. * (bug 16288) API: consider making closure status of wikis more clear with meta=siteinfo * (bug 27589) list=allimages&aiprop=archivename is useless +* (bug 27586) Remove duplication of props in ApiQueryStashImageInfo + by using ApiQueryImageInfo === Languages updated in 1.18 === diff --git a/includes/api/ApiQueryStashImageInfo.php b/includes/api/ApiQueryStashImageInfo.php index b145657c17..437a13e5b3 100644 --- a/includes/api/ApiQueryStashImageInfo.php +++ b/includes/api/ApiQueryStashImageInfo.php @@ -61,22 +61,10 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { } } - /** - * Returns all valid parameters to siiprop - */ - public static function getPropertyNames() { - return array( - 'timestamp', - 'url', - 'size', - 'dimensions', // For backwards compatibility with Allimages - 'sha1', - 'mime', - 'thumbmime', - 'metadata', - 'bitdepth', - ); - } + private $propertyFilter = array( + 'user', 'userid', 'comment', 'parsedcomment', + 'mediatype', 'archivename', + ); public function getAllowedParams() { return array( @@ -88,7 +76,7 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { 'prop' => array( ApiBase::PARAM_ISMULTI => true, ApiBase::PARAM_DFLT => 'timestamp|url', - ApiBase::PARAM_TYPE => self::getPropertyNames() + ApiBase::PARAM_TYPE => self::getPropertyNames( $this->propertyFilter ) ), 'urlwidth' => array( ApiBase::PARAM_TYPE => 'integer', @@ -112,18 +100,7 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { public function getParamDescription() { $p = $this->getModulePrefix(); return array( - 'prop' => array( - 'What image information to get:', - ' timestamp - Adds timestamp for the uploaded version', - ' url - Gives URL to the image and the description page', - ' size - Adds the size of the image in bytes and the height, width and page count (if applicable)', - ' dimensions - Alias for size', - ' sha1 - Adds sha1 hash for the image', - ' mime - Adds MIME of the image', - ' thumbmime - Adds MIME of the image thumbnail (requires url)', - ' metadata - Lists EXIF metadata for the version of the image', - ' bitdepth - Adds the bit depth of the version', - ), + 'prop' => self::getPropertyDescriptions( $this->propertyFilter ), 'sessionkey' => 'Session key that identifies a previous upload that was stashed temporarily.', 'urlwidth' => "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.", 'urlheight' => "Similar to {$p}urlwidth. Cannot be used without {$p}urlwidth", -- 2.20.1