r84502 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84501‎ | r84502 | r84503 >
Date:23:51, 21 March 2011
Author:reedy
Status:ok
Tags:
Comment:
* (bug 27589) list=allimages&aiprop=archivename is useless

Followup r84433

Add way to filter returned properties/descriptions
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryAllimages.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryImageInfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryAllimages.php
@@ -203,7 +203,7 @@
204204 'sha1' => null,
205205 'sha1base36' => null,
206206 'prop' => array(
207 - ApiBase::PARAM_TYPE => ApiQueryImageInfo::getPropertyNames(),
 207+ ApiBase::PARAM_TYPE => ApiQueryImageInfo::getPropertyNames( $this->propertyFilter ),
208208 ApiBase::PARAM_DFLT => 'timestamp|url',
209209 ApiBase::PARAM_ISMULTI => true
210210 ),
@@ -222,11 +222,13 @@
223223 'limit' => 'How many images in total to return',
224224 'sha1' => "SHA1 hash of image. Overrides {$this->getModulePrefix()}sha1base36",
225225 'sha1base36' => 'SHA1 hash of image in base 36 (used in MediaWiki)',
226 - 'prop' => ApiQueryImageInfo::getPropertyDescriptions(),
 226+ 'prop' => ApiQueryImageInfo::getPropertyDescriptions( $this->propertyFilter ),
227227 'mime' => 'What MIME type to search for. e.g. image/jpeg. Disabled in Miser Mode',
228228 );
229229 }
230230
 231+ private $propertyFilter = array( 'archivename' );
 232+
231233 public function getDescription() {
232234 return 'Enumerate all images sequentially';
233235 }
Index: trunk/phase3/includes/api/ApiQueryImageInfo.php
@@ -471,15 +471,18 @@
472472
473473 /**
474474 * Returns all possible parameters to iiprop
 475+ *
 476+ * @param array $filter List of properties to filter out
 477+ *
475478 * @static
476479 * @return Array
477480 */
478 - public static function getPropertyNames() {
479 - return array_keys( self::getProperties() );
 481+ public static function getPropertyNames( $filter = array() ) {
 482+ return array_diff( array_keys( self::getProperties() ), $filter );
480483 }
481484
482485 /**
483 - * Returns array key value pairs of
 486+ * Returns array key value pairs of properties and their descriptions
484487 *
485488 * @static
486489 * @return array
@@ -506,14 +509,16 @@
507510
508511 /**
509512 * Returns the descriptions for the properties provided by getPropertyNames()
 513+ *
 514+ * @param array $filter List of properties to filter out
510515 *
511516 * @static
512517 * @return array
513518 */
514 - public static function getPropertyDescriptions() {
 519+ public static function getPropertyDescriptions( $filter = array() ) {
515520 return array_merge(
516521 array( 'What image information to get:' ),
517 - array_values( self::getProperties() )
 522+ array_values( array_diff_key( self::getProperties(), array_flip( $filter ) ) )
518523 );
519524 }
520525
Index: trunk/phase3/RELEASE-NOTES
@@ -276,6 +276,7 @@
277277 the general site info results
278278 * (bug 16288) API: consider making closure status of wikis more clear
279279 with meta=siteinfo
 280+* (bug 27589) list=allimages&aiprop=archivename is useless
280281
281282 === Languages updated in 1.18 ===
282283

Follow-up revisions

RevisionCommit summaryAuthorDate
r84504* (bug 27586) Remove duplication of props in ApiQueryStashImageInfo by using ...reedy00:08, 22 March 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r84433Start of bug 27586/bug 27589...reedy23:50, 20 March 2011

Status & tagging log