r84504 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84503‎ | r84504 | r84505 >
Date:00:08, 22 March 2011
Author:reedy
Status:ok
Tags:
Comment:
* (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
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryStashImageInfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryStashImageInfo.php
@@ -61,22 +61,10 @@
6262 }
6363 }
6464
65 - /**
66 - * Returns all valid parameters to siiprop
67 - */
68 - public static function getPropertyNames() {
69 - return array(
70 - 'timestamp',
71 - 'url',
72 - 'size',
73 - 'dimensions', // For backwards compatibility with Allimages
74 - 'sha1',
75 - 'mime',
76 - 'thumbmime',
77 - 'metadata',
78 - 'bitdepth',
79 - );
80 - }
 65+ private $propertyFilter = array(
 66+ 'user', 'userid', 'comment', 'parsedcomment',
 67+ 'mediatype', 'archivename',
 68+ );
8169
8270 public function getAllowedParams() {
8371 return array(
@@ -88,7 +76,7 @@
8977 'prop' => array(
9078 ApiBase::PARAM_ISMULTI => true,
9179 ApiBase::PARAM_DFLT => 'timestamp|url',
92 - ApiBase::PARAM_TYPE => self::getPropertyNames()
 80+ ApiBase::PARAM_TYPE => self::getPropertyNames( $this->propertyFilter )
9381 ),
9482 'urlwidth' => array(
9583 ApiBase::PARAM_TYPE => 'integer',
@@ -112,18 +100,7 @@
113101 public function getParamDescription() {
114102 $p = $this->getModulePrefix();
115103 return array(
116 - 'prop' => array(
117 - 'What image information to get:',
118 - ' timestamp - Adds timestamp for the uploaded version',
119 - ' url - Gives URL to the image and the description page',
120 - ' size - Adds the size of the image in bytes and the height, width and page count (if applicable)',
121 - ' dimensions - Alias for size',
122 - ' sha1 - Adds sha1 hash for the image',
123 - ' mime - Adds MIME of the image',
124 - ' thumbmime - Adds MIME of the image thumbnail (requires url)',
125 - ' metadata - Lists EXIF metadata for the version of the image',
126 - ' bitdepth - Adds the bit depth of the version',
127 - ),
 104+ 'prop' => self::getPropertyDescriptions( $this->propertyFilter ),
128105 'sessionkey' => 'Session key that identifies a previous upload that was stashed temporarily.',
129106 'urlwidth' => "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.",
130107 'urlheight' => "Similar to {$p}urlwidth. Cannot be used without {$p}urlwidth",
Index: trunk/phase3/RELEASE-NOTES
@@ -277,6 +277,8 @@
278278 * (bug 16288) API: consider making closure status of wikis more clear
279279 with meta=siteinfo
280280 * (bug 27589) list=allimages&aiprop=archivename is useless
 281+* (bug 27586) Remove duplication of props in ApiQueryStashImageInfo
 282+ by using ApiQueryImageInfo
281283
282284 === Languages updated in 1.18 ===
283285

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r84433Start of bug 27586/bug 27589...reedy23:50, 20 March 2011
r84502* (bug 27589) list=allimages&aiprop=archivename is useless...reedy23:51, 21 March 2011

Status & tagging log