http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84502
Revision: 84502
Author: reedy
Date: 2011-03-21 23:51:26 +0000 (Mon, 21 Mar 2011)
Log Message:
-----------
* (bug 27589) list=allimages&aiprop=archivename is useless
Followup r84433
Add way to filter returned properties/descriptions
Modified Paths:
--------------
trunk/phase3/RELEASE-NOTES
trunk/phase3/includes/api/ApiQueryAllimages.php
trunk/phase3/includes/api/ApiQueryImageInfo.php
Modified: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES 2011-03-21 23:47:29 UTC (rev 84501)
+++ trunk/phase3/RELEASE-NOTES 2011-03-21 23:51:26 UTC (rev 84502)
@@ -276,6 +276,7 @@
the general site info results
* (bug 16288) API: consider making closure status of wikis more clear
with meta=siteinfo
+* (bug 27589) list=allimages&aiprop=archivename is useless
=== Languages updated in 1.18 ===
Modified: trunk/phase3/includes/api/ApiQueryAllimages.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryAllimages.php 2011-03-21 23:47:29 UTC
(rev 84501)
+++ trunk/phase3/includes/api/ApiQueryAllimages.php 2011-03-21 23:51:26 UTC
(rev 84502)
@@ -203,7 +203,7 @@
'sha1' => null,
'sha1base36' => null,
'prop' => array(
- ApiBase::PARAM_TYPE =>
ApiQueryImageInfo::getPropertyNames(),
+ ApiBase::PARAM_TYPE =>
ApiQueryImageInfo::getPropertyNames( $this->propertyFilter ),
ApiBase::PARAM_DFLT => 'timestamp|url',
ApiBase::PARAM_ISMULTI => true
),
@@ -222,11 +222,13 @@
'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' => ApiQueryImageInfo::getPropertyDescriptions(),
+ 'prop' => ApiQueryImageInfo::getPropertyDescriptions(
$this->propertyFilter ),
'mime' => 'What MIME type to search for. e.g.
image/jpeg. Disabled in Miser Mode',
);
}
+ private $propertyFilter = array( 'archivename' );
+
public function getDescription() {
return 'Enumerate all images sequentially';
}
Modified: trunk/phase3/includes/api/ApiQueryImageInfo.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryImageInfo.php 2011-03-21 23:47:29 UTC
(rev 84501)
+++ trunk/phase3/includes/api/ApiQueryImageInfo.php 2011-03-21 23:51:26 UTC
(rev 84502)
@@ -471,15 +471,18 @@
/**
* Returns all possible parameters to iiprop
+ *
+ * @param array $filter List of properties to filter out
+ *
* @static
* @return Array
*/
- public static function getPropertyNames() {
- return array_keys( self::getProperties() );
+ public static function getPropertyNames( $filter = array() ) {
+ return array_diff( array_keys( self::getProperties() ), $filter
);
}
/**
- * Returns array key value pairs of
+ * Returns array key value pairs of properties and their descriptions
*
* @static
* @return array
@@ -506,14 +509,16 @@
/**
* Returns the descriptions for the properties provided by
getPropertyNames()
+ *
+ * @param array $filter List of properties to filter out
*
* @static
* @return array
*/
- public static function getPropertyDescriptions() {
+ public static function getPropertyDescriptions( $filter = array() ) {
return array_merge(
array( 'What image information to get:' ),
- array_values( self::getProperties() )
+ array_values( array_diff_key( self::getProperties(),
array_flip( $filter ) ) )
);
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs