From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- includes/api/ApiQueryImages.php | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'includes/api/ApiQueryImages.php') diff --git a/includes/api/ApiQueryImages.php b/includes/api/ApiQueryImages.php index af2920c7..9dfdf341 100644 --- a/includes/api/ApiQueryImages.php +++ b/includes/api/ApiQueryImages.php @@ -1,6 +1,6 @@ run( $resultPageSet ); } + /** + * @param $resultPageSet ApiPageSet + */ private function run( $resultPageSet = null ) { if ( $this->getPageSet()->getGoodTitleCount() == 0 ) { return; // nothing to do @@ -84,6 +87,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 +152,9 @@ class ApiQueryImages extends ApiQueryGeneratorBase { ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2 ), 'continue' => null, + 'images' => array( + ApiBase::PARAM_ISMULTI => true, + ) ); } @@ -143,6 +162,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.', ); } @@ -165,7 +185,11 @@ class ApiQueryImages extends ApiQueryGeneratorBase { ); } + public function getHelpUrls() { + return 'https://www.mediawiki.org/wiki/API:Properties#images_.2F_im'; + } + public function getVersion() { - return __CLASS__ . ': $Id: ApiQueryImages.php 73543 2010-09-22 16:50:09Z platonides $'; + return __CLASS__ . ': $Id: ApiQueryImages.php 104449 2011-11-28 15:52:04Z reedy $'; } } -- cgit v1.2.3-54-g00ecf