From: Sam Reed Date: Wed, 5 Jan 2011 02:52:04 +0000 (+0000) Subject: * (bug 26482) add a imimages param to prop=images X-Git-Tag: 1.31.0-rc.0~32815 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;ds=sidebyside;h=da31774f70790b153b01a8cfeb82e30eb7516ac1;p=lhc%2Fweb%2Fwiklou.git * (bug 26482) add a imimages param to prop=images --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0260cc47d8..45108fbcc8 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -72,6 +72,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 26560) On allusers if limit < total number of users, last user gets duplicate * (bug 25135) add "normalized" to action=parse * (bug 26460) Add support for listing category members by category pageid +* (bug 26482) add a imimages param to prop=images === Languages updated in 1.18 === diff --git a/includes/LinkBatch.php b/includes/LinkBatch.php index e689f9660e..77c4edd1ce 100644 --- a/includes/LinkBatch.php +++ b/includes/LinkBatch.php @@ -32,6 +32,10 @@ class LinkBatch { $this->caller = $caller; } + /** + * @param $title Title + * @return void + */ public function addObj( $title ) { if ( is_object( $title ) ) { $this->add( $title->getNamespace(), $title->getDBkey() ); diff --git a/includes/api/ApiQueryImages.php b/includes/api/ApiQueryImages.php index 445198500c..16d770c8c4 100644 --- a/includes/api/ApiQueryImages.php +++ b/includes/api/ApiQueryImages.php @@ -84,6 +84,19 @@ class ApiQueryImages extends ApiQueryGeneratorBase { } $this->addOption( 'LIMIT', $params['limit'] + 1 ); + if ( !is_null( $params['images'] ) ) { + $images = array(); + foreach ( $params['images'] as $img ) { + $title = Title::newFromText( $img ); + if ( !$title || $title->getNamespace() != NS_FILE ) { + $this->setWarning( "``$img'' is not a file" ); + } else { + $images[] = $title->getDBkey(); + } + } + $this->addWhereFld( 'il_to', $images ); + } + $res = $this->select( __METHOD__ ); if ( is_null( $resultPageSet ) ) { @@ -136,6 +149,9 @@ class ApiQueryImages extends ApiQueryGeneratorBase { ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2 ), 'continue' => null, + 'images' => array( + ApiBase::PARAM_ISMULTI => true, + ) ); } @@ -143,6 +159,7 @@ class ApiQueryImages extends ApiQueryGeneratorBase { return array( 'limit' => 'How many images to return', 'continue' => 'When more results are available, use this to continue', + 'images' => 'Only list these images. Useful for checking whether a certain page has a certain Image.', ); }