r79637 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79636‎ | r79637 | r79638 >
Date:02:52, 5 January 2011
Author:reedy
Status:ok
Tags:
Comment:
* (bug 26482) add a imimages param to prop=images
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/LinkBatch.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryImages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LinkBatch.php
@@ -32,6 +32,10 @@
3333 $this->caller = $caller;
3434 }
3535
 36+ /**
 37+ * @param $title Title
 38+ * @return void
 39+ */
3640 public function addObj( $title ) {
3741 if ( is_object( $title ) ) {
3842 $this->add( $title->getNamespace(), $title->getDBkey() );
Index: trunk/phase3/includes/api/ApiQueryImages.php
@@ -84,6 +84,19 @@
8585 }
8686 $this->addOption( 'LIMIT', $params['limit'] + 1 );
8787
 88+ if ( !is_null( $params['images'] ) ) {
 89+ $images = array();
 90+ foreach ( $params['images'] as $img ) {
 91+ $title = Title::newFromText( $img );
 92+ if ( !$title || $title->getNamespace() != NS_FILE ) {
 93+ $this->setWarning( "``$img'' is not a file" );
 94+ } else {
 95+ $images[] = $title->getDBkey();
 96+ }
 97+ }
 98+ $this->addWhereFld( 'il_to', $images );
 99+ }
 100+
88101 $res = $this->select( __METHOD__ );
89102
90103 if ( is_null( $resultPageSet ) ) {
@@ -136,6 +149,9 @@
137150 ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
138151 ),
139152 'continue' => null,
 153+ 'images' => array(
 154+ ApiBase::PARAM_ISMULTI => true,
 155+ )
140156 );
141157 }
142158
@@ -143,6 +159,7 @@
144160 return array(
145161 'limit' => 'How many images to return',
146162 'continue' => 'When more results are available, use this to continue',
 163+ 'images' => 'Only list these images. Useful for checking whether a certain page has a certain Image.',
147164 );
148165 }
149166
Index: trunk/phase3/RELEASE-NOTES
@@ -72,6 +72,7 @@
7373 * (bug 26560) On allusers if limit < total number of users, last user gets duplicate
7474 * (bug 25135) add "normalized" to action=parse
7575 * (bug 26460) Add support for listing category members by category pageid
 76+* (bug 26482) add a imimages param to prop=images
7677
7778 === Languages updated in 1.18 ===
7879

Status & tagging log