raise timeout for CdbTest::testCdb()
[lhc/web/wiklou.git] / includes / api / ApiQueryImageInfo.php
1 <?php
2 /**
3 *
4 *
5 * Created on July 6, 2007
6 *
7 * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * http://www.gnu.org/copyleft/gpl.html
23 *
24 * @file
25 */
26
27 /**
28 * A query action to get image information and upload history.
29 *
30 * @ingroup API
31 */
32 class ApiQueryImageInfo extends ApiQueryBase {
33
34 public function __construct( $query, $moduleName, $prefix = 'ii' ) {
35 // We allow a subclass to override the prefix, to create a related API module.
36 // Some other parts of MediaWiki construct this with a null $prefix, which used to be ignored when this only took two arguments
37 if ( is_null( $prefix ) ) {
38 $prefix = 'ii';
39 }
40 parent::__construct( $query, $moduleName, $prefix );
41 }
42
43 public function execute() {
44 $params = $this->extractRequestParams();
45
46 $prop = array_flip( $params['prop'] );
47
48 $scale = $this->getScale( $params );
49
50 $pageIds = $this->getPageSet()->getAllTitlesByNamespace();
51 if ( !empty( $pageIds[NS_FILE] ) ) {
52 $titles = array_keys( $pageIds[NS_FILE] );
53 asort( $titles ); // Ensure the order is always the same
54
55 $skip = false;
56 if ( !is_null( $params['continue'] ) ) {
57 $skip = true;
58 $cont = explode( '|', $params['continue'] );
59 $this->dieContinueUsageIf( count( $cont ) != 2 );
60 $fromTitle = strval( $cont[0] );
61 $fromTimestamp = $cont[1];
62 // Filter out any titles before $fromTitle
63 foreach ( $titles as $key => $title ) {
64 if ( $title < $fromTitle ) {
65 unset( $titles[$key] );
66 } else {
67 break;
68 }
69 }
70 }
71
72 $result = $this->getResult();
73 //search only inside the local repo
74 if( $params['localonly'] ) {
75 $images = RepoGroup::singleton()->getLocalRepo()->findFiles( $titles );
76 } else {
77 $images = RepoGroup::singleton()->findFiles( $titles );
78 }
79 foreach ( $titles as $title ) {
80 if ( !isset( $images[$title] ) ) {
81 continue;
82 }
83
84 $start = $skip ? $fromTimestamp : $params['start'];
85 $pageId = $pageIds[NS_FILE][$title];
86 $img = $images[$title];
87
88 $fit = $result->addValue(
89 array( 'query', 'pages', intval( $pageId ) ),
90 'imagerepository', $img->getRepoName()
91 );
92 if ( !$fit ) {
93 if ( count( $pageIds[NS_FILE] ) == 1 ) {
94 // The user is screwed. imageinfo can't be solely
95 // responsible for exceeding the limit in this case,
96 // so set a query-continue that just returns the same
97 // thing again. When the violating queries have been
98 // out-continued, the result will get through
99 $this->setContinueEnumParameter( 'start',
100 wfTimestamp( TS_ISO_8601, $img->getTimestamp() ) );
101 } else {
102 $this->setContinueEnumParameter( 'continue',
103 $this->getContinueStr( $img ) );
104 }
105 break;
106 }
107
108 // Check if we can make the requested thumbnail, and get transform parameters.
109 $finalThumbParams = $this->mergeThumbParams( $img, $scale, $params['urlparam'] );
110
111 // Get information about the current version first
112 // Check that the current version is within the start-end boundaries
113 $gotOne = false;
114 if (
115 ( is_null( $start ) || $img->getTimestamp() <= $start ) &&
116 ( is_null( $params['end'] ) || $img->getTimestamp() >= $params['end'] )
117 ) {
118 $gotOne = true;
119
120 $fit = $this->addPageSubItem( $pageId,
121 self::getInfo( $img, $prop, $result,
122 $finalThumbParams, $params['metadataversion'] ) );
123 if ( !$fit ) {
124 if ( count( $pageIds[NS_FILE] ) == 1 ) {
125 // See the 'the user is screwed' comment above
126 $this->setContinueEnumParameter( 'start',
127 wfTimestamp( TS_ISO_8601, $img->getTimestamp() ) );
128 } else {
129 $this->setContinueEnumParameter( 'continue',
130 $this->getContinueStr( $img ) );
131 }
132 break;
133 }
134 }
135
136 // Now get the old revisions
137 // Get one more to facilitate query-continue functionality
138 $count = ( $gotOne ? 1 : 0 );
139 $oldies = $img->getHistory( $params['limit'] - $count + 1, $start, $params['end'] );
140 foreach ( $oldies as $oldie ) {
141 if ( ++$count > $params['limit'] ) {
142 // We've reached the extra one which shows that there are additional pages to be had. Stop here...
143 // Only set a query-continue if there was only one title
144 if ( count( $pageIds[NS_FILE] ) == 1 ) {
145 $this->setContinueEnumParameter( 'start',
146 wfTimestamp( TS_ISO_8601, $oldie->getTimestamp() ) );
147 }
148 break;
149 }
150 $fit = $this->addPageSubItem( $pageId,
151 self::getInfo( $oldie, $prop, $result,
152 $finalThumbParams, $params['metadataversion'] ) );
153 if ( !$fit ) {
154 if ( count( $pageIds[NS_FILE] ) == 1 ) {
155 $this->setContinueEnumParameter( 'start',
156 wfTimestamp( TS_ISO_8601, $oldie->getTimestamp() ) );
157 } else {
158 $this->setContinueEnumParameter( 'continue',
159 $this->getContinueStr( $oldie ) );
160 }
161 break;
162 }
163 }
164 if ( !$fit ) {
165 break;
166 }
167 $skip = false;
168 }
169
170 $data = $this->getResultData();
171 foreach ( $data['query']['pages'] as $pageid => $arr ) {
172 if ( is_array( $arr ) && !isset( $arr['imagerepository'] ) ) {
173 $result->addValue(
174 array( 'query', 'pages', $pageid ),
175 'imagerepository', ''
176 );
177 }
178 // The above can't fail because it doesn't increase the result size
179 }
180 }
181 }
182
183 /**
184 * From parameters, construct a 'scale' array
185 * @param $params Array: Parameters passed to api.
186 * @return Array or Null: key-val array of 'width' and 'height', or null
187 */
188 public function getScale( $params ) {
189 $p = $this->getModulePrefix();
190
191 // Height and width.
192 if ( $params['urlheight'] != -1 && $params['urlwidth'] == -1 ) {
193 $this->dieUsage( "{$p}urlheight cannot be used without {$p}urlwidth", "{$p}urlwidth" );
194 }
195
196 if ( $params['urlwidth'] != -1 ) {
197 $scale = array();
198 $scale['width'] = $params['urlwidth'];
199 $scale['height'] = $params['urlheight'];
200 } else {
201 $scale = null;
202 if ( $params['urlparam'] ) {
203 $this->dieUsage( "{$p}urlparam requires {$p}urlwidth", "urlparam_no_width" );
204 }
205 return $scale;
206 }
207
208 return $scale;
209 }
210
211 /** Validate and merge scale parameters with handler thumb parameters, give error if invalid.
212 *
213 * We do this later than getScale, since we need the image
214 * to know which handler, since handlers can make their own parameters.
215 * @param File $image Image that params are for.
216 * @param Array $thumbParams thumbnail parameters from getScale
217 * @param String $otherParams of otherParams (iiurlparam).
218 * @return Array of parameters for transform.
219 */
220 protected function mergeThumbParams ( $image, $thumbParams, $otherParams ) {
221 if ( !$otherParams ) {
222 return $thumbParams;
223 }
224 $p = $this->getModulePrefix();
225
226 $h = $image->getHandler();
227 if ( !$h ) {
228 $this->setWarning( 'Could not create thumbnail because ' .
229 $image->getName() . ' does not have an associated image handler' );
230 return $thumbParams;
231 }
232
233 $paramList = $h->parseParamString( $otherParams );
234 if ( !$paramList ) {
235 // Just set a warning (instead of dieUsage), as in many cases
236 // we could still render the image using width and height parameters,
237 // and this type of thing could happen between different versions of
238 // handlers.
239 $this->setWarning( "Could not parse {$p}urlparam for " . $image->getName()
240 . '. Using only width and height' );
241 return $thumbParams;
242 }
243
244 if ( isset( $paramList['width'] ) ) {
245 if ( intval( $paramList['width'] ) != intval( $thumbParams['width'] ) ) {
246 $this->dieUsage( "{$p}urlparam had width of {$paramList['width']} but "
247 . "{$p}urlwidth was {$thumbParams['width']}", "urlparam_urlwidth_mismatch" );
248 }
249 }
250
251 foreach ( $paramList as $name => $value ) {
252 if ( !$h->validateParam( $name, $value ) ) {
253 $this->dieUsage( "Invalid value for {$p}urlparam ($name=$value)", "urlparam" );
254 }
255 }
256
257 return $thumbParams + $paramList;
258 }
259
260 /**
261 * Get result information for an image revision
262 *
263 * @param $file File object
264 * @param $prop Array of properties to get (in the keys)
265 * @param $result ApiResult object
266 * @param $thumbParams Array containing 'width' and 'height' items, or null
267 * @param $version string Version of image metadata (for things like jpeg which have different versions).
268 * @return Array: result array
269 */
270 static function getInfo( $file, $prop, $result, $thumbParams = null, $version = 'latest' ) {
271 $vals = array();
272 // Timestamp is shown even if the file is revdelete'd in interface
273 // so do same here.
274 if ( isset( $prop['timestamp'] ) ) {
275 $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $file->getTimestamp() );
276 }
277
278 $user = isset( $prop['user'] );
279 $userid = isset( $prop['userid'] );
280
281 if ( $user || $userid ) {
282 if ( $file->isDeleted( File::DELETED_USER ) ) {
283 $vals['userhidden'] = '';
284 } else {
285 if ( $user ) {
286 $vals['user'] = $file->getUser();
287 }
288 if ( $userid ) {
289 $vals['userid'] = $file->getUser( 'id' );
290 }
291 if ( !$file->getUser( 'id' ) ) {
292 $vals['anon'] = '';
293 }
294 }
295 }
296
297 // This is shown even if the file is revdelete'd in interface
298 // so do same here.
299 if ( isset( $prop['size'] ) || isset( $prop['dimensions'] ) ) {
300 $vals['size'] = intval( $file->getSize() );
301 $vals['width'] = intval( $file->getWidth() );
302 $vals['height'] = intval( $file->getHeight() );
303
304 $pageCount = $file->pageCount();
305 if ( $pageCount !== false ) {
306 $vals['pagecount'] = $pageCount;
307 }
308 }
309
310 $pcomment = isset( $prop['parsedcomment'] );
311 $comment = isset( $prop['comment'] );
312
313 if ( $pcomment || $comment ) {
314 if ( $file->isDeleted( File::DELETED_COMMENT ) ) {
315 $vals['commenthidden'] = '';
316 } else {
317 if ( $pcomment ) {
318 $vals['parsedcomment'] = Linker::formatComment(
319 $file->getDescription(), $file->getTitle() );
320 }
321 if ( $comment ) {
322 $vals['comment'] = $file->getDescription();
323 }
324 }
325 }
326
327 $url = isset( $prop['url'] );
328 $sha1 = isset( $prop['sha1'] );
329 $meta = isset( $prop['metadata'] );
330 $mime = isset( $prop['mime'] );
331 $mediatype = isset( $prop['mediatype'] );
332 $archive = isset( $prop['archivename'] );
333 $bitdepth = isset( $prop['bitdepth'] );
334
335 if ( ( $url || $sha1 || $meta || $mime || $mediatype || $archive || $bitdepth )
336 && $file->isDeleted( File::DELETED_FILE ) ) {
337 $vals['filehidden'] = '';
338
339 //Early return, tidier than indenting all following things one level
340 return $vals;
341 }
342
343 if ( $url ) {
344 if ( !is_null( $thumbParams ) ) {
345 $mto = $file->transform( $thumbParams );
346 if ( $mto && !$mto->isError() ) {
347 $vals['thumburl'] = wfExpandUrl( $mto->getUrl(), PROTO_CURRENT );
348
349 // bug 23834 - If the URL's are the same, we haven't resized it, so shouldn't give the wanted
350 // thumbnail sizes for the thumbnail actual size
351 if ( $mto->getUrl() !== $file->getUrl() ) {
352 $vals['thumbwidth'] = intval( $mto->getWidth() );
353 $vals['thumbheight'] = intval( $mto->getHeight() );
354 } else {
355 $vals['thumbwidth'] = intval( $file->getWidth() );
356 $vals['thumbheight'] = intval( $file->getHeight() );
357 }
358
359 if ( isset( $prop['thumbmime'] ) && $file->getHandler() ) {
360 list( $ext, $mime ) = $file->getHandler()->getThumbType(
361 $mto->getExtension(), $file->getMimeType(), $thumbParams );
362 $vals['thumbmime'] = $mime;
363 }
364 } elseif ( $mto && $mto->isError() ) {
365 $vals['thumberror'] = $mto->toText();
366 }
367 }
368 $vals['url'] = wfExpandUrl( $file->getFullURL(), PROTO_CURRENT );
369 $vals['descriptionurl'] = wfExpandUrl( $file->getDescriptionUrl(), PROTO_CURRENT );
370 }
371
372 if ( $sha1 ) {
373 $vals['sha1'] = wfBaseConvert( $file->getSha1(), 36, 16, 40 );
374 }
375
376 if ( $meta ) {
377 wfSuppressWarnings();
378 $metadata = unserialize( $file->getMetadata() );
379 wfRestoreWarnings();
380 if ( $metadata && $version !== 'latest' ) {
381 $metadata = $file->convertMetadataVersion( $metadata, $version );
382 }
383 $vals['metadata'] = $metadata ? self::processMetaData( $metadata, $result ) : null;
384 }
385
386 if ( $mime ) {
387 $vals['mime'] = $file->getMimeType();
388 }
389
390 if ( $mediatype ) {
391 $vals['mediatype'] = $file->getMediaType();
392 }
393
394 if ( $archive && $file->isOld() ) {
395 $vals['archivename'] = $file->getArchiveName();
396 }
397
398 if ( $bitdepth ) {
399 $vals['bitdepth'] = $file->getBitDepth();
400 }
401
402 return $vals;
403 }
404
405 /**
406 *
407 * @param $metadata Array
408 * @param $result ApiResult
409 * @return Array
410 */
411 public static function processMetaData( $metadata, $result ) {
412 $retval = array();
413 if ( is_array( $metadata ) ) {
414 foreach ( $metadata as $key => $value ) {
415 $r = array( 'name' => $key );
416 if ( is_array( $value ) ) {
417 $r['value'] = self::processMetaData( $value, $result );
418 } else {
419 $r['value'] = $value;
420 }
421 $retval[] = $r;
422 }
423 }
424 $result->setIndexedTagName( $retval, 'metadata' );
425 return $retval;
426 }
427
428 public function getCacheMode( $params ) {
429 return 'public';
430 }
431
432 /**
433 * @param $img File
434 * @return string
435 */
436 protected function getContinueStr( $img ) {
437 return $img->getOriginalTitle()->getText() .
438 '|' . $img->getTimestamp();
439 }
440
441 public function getAllowedParams() {
442 return array(
443 'prop' => array(
444 ApiBase::PARAM_ISMULTI => true,
445 ApiBase::PARAM_DFLT => 'timestamp|user',
446 ApiBase::PARAM_TYPE => self::getPropertyNames()
447 ),
448 'limit' => array(
449 ApiBase::PARAM_TYPE => 'limit',
450 ApiBase::PARAM_DFLT => 1,
451 ApiBase::PARAM_MIN => 1,
452 ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
453 ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
454 ),
455 'start' => array(
456 ApiBase::PARAM_TYPE => 'timestamp'
457 ),
458 'end' => array(
459 ApiBase::PARAM_TYPE => 'timestamp'
460 ),
461 'urlwidth' => array(
462 ApiBase::PARAM_TYPE => 'integer',
463 ApiBase::PARAM_DFLT => -1
464 ),
465 'urlheight' => array(
466 ApiBase::PARAM_TYPE => 'integer',
467 ApiBase::PARAM_DFLT => -1
468 ),
469 'metadataversion' => array(
470 ApiBase::PARAM_TYPE => 'string',
471 ApiBase::PARAM_DFLT => '1',
472 ),
473 'urlparam' => array(
474 ApiBase::PARAM_DFLT => '',
475 ApiBase::PARAM_TYPE => 'string',
476 ),
477 'continue' => null,
478 'localonly' => false,
479 );
480 }
481
482 /**
483 * Returns all possible parameters to iiprop
484 *
485 * @param array $filter List of properties to filter out
486 *
487 * @return Array
488 */
489 public static function getPropertyNames( $filter = array() ) {
490 return array_diff( array_keys( self::getProperties() ), $filter );
491 }
492
493 /**
494 * Returns array key value pairs of properties and their descriptions
495 *
496 * @return array
497 */
498 private static function getProperties( $modulePrefix = '' ) {
499 return array(
500 'timestamp' => ' timestamp - Adds timestamp for the uploaded version',
501 'user' => ' user - Adds the user who uploaded the image version',
502 'userid' => ' userid - Add the user ID that uploaded the image version',
503 'comment' => ' comment - Comment on the version',
504 'parsedcomment' => ' parsedcomment - Parse the comment on the version',
505 'url' => ' url - Gives URL to the image and the description page',
506 'size' => ' size - Adds the size of the image in bytes and the height, width and page count (if applicable)',
507 'dimensions' => ' dimensions - Alias for size', // For backwards compatibility with Allimages
508 'sha1' => ' sha1 - Adds SHA-1 hash for the image',
509 'mime' => ' mime - Adds MIME type of the image',
510 'thumbmime' => ' thumbmime - Adds MIME type of the image thumbnail' .
511 ' (requires url and param ' . $modulePrefix . 'urlwidth)',
512 'mediatype' => ' mediatype - Adds the media type of the image',
513 'metadata' => ' metadata - Lists EXIF metadata for the version of the image',
514 'archivename' => ' archivename - Adds the file name of the archive version for non-latest versions',
515 'bitdepth' => ' bitdepth - Adds the bit depth of the version',
516 );
517 }
518
519 /**
520 * Returns the descriptions for the properties provided by getPropertyNames()
521 *
522 * @param array $filter List of properties to filter out
523 *
524 * @return array
525 */
526 public static function getPropertyDescriptions( $filter = array(), $modulePrefix = '' ) {
527 return array_merge(
528 array( 'What image information to get:' ),
529 array_values( array_diff_key( self::getProperties( $modulePrefix ), array_flip( $filter ) ) )
530 );
531 }
532
533 /**
534 * Return the API documentation for the parameters.
535 * @return Array parameter documentation.
536 */
537 public function getParamDescription() {
538 $p = $this->getModulePrefix();
539 return array(
540 'prop' => self::getPropertyDescriptions( array(), $p ),
541 'urlwidth' => array( "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.",
542 'Only the current version of the image can be scaled' ),
543 'urlheight' => "Similar to {$p}urlwidth. Cannot be used without {$p}urlwidth",
544 'urlparam' => array( "A handler specific parameter string. For example, pdf's ",
545 "might use 'page15-100px'. {$p}urlwidth must be used and be consistent with {$p}urlparam" ),
546 'limit' => 'How many image revisions to return',
547 'start' => 'Timestamp to start listing from',
548 'end' => 'Timestamp to stop listing at',
549 'metadataversion' => array( "Version of metadata to use. if 'latest' is specified, use latest version.",
550 "Defaults to '1' for backwards compatibility" ),
551 'continue' => 'If the query response includes a continue value, use it here to get another page of results',
552 'localonly' => 'Look only for files in the local repository',
553 );
554 }
555
556 public static function getResultPropertiesFiltered( $filter = array() ) {
557 $props = array(
558 'timestamp' => array(
559 'timestamp' => 'timestamp'
560 ),
561 'user' => array(
562 'userhidden' => 'boolean',
563 'user' => 'string',
564 'anon' => 'boolean'
565 ),
566 'userid' => array(
567 'userhidden' => 'boolean',
568 'userid' => 'integer',
569 'anon' => 'boolean'
570 ),
571 'size' => array(
572 'size' => 'integer',
573 'width' => 'integer',
574 'height' => 'integer',
575 'pagecount' => array(
576 ApiBase::PROP_TYPE => 'integer',
577 ApiBase::PROP_NULLABLE => true
578 )
579 ),
580 'dimensions' => array(
581 'size' => 'integer',
582 'width' => 'integer',
583 'height' => 'integer',
584 'pagecount' => array(
585 ApiBase::PROP_TYPE => 'integer',
586 ApiBase::PROP_NULLABLE => true
587 )
588 ),
589 'comment' => array(
590 'commenthidden' => 'boolean',
591 'comment' => array(
592 ApiBase::PROP_TYPE => 'string',
593 ApiBase::PROP_NULLABLE => true
594 )
595 ),
596 'parsedcomment' => array(
597 'commenthidden' => 'boolean',
598 'parsedcomment' => array(
599 ApiBase::PROP_TYPE => 'string',
600 ApiBase::PROP_NULLABLE => true
601 )
602 ),
603 'url' => array(
604 'filehidden' => 'boolean',
605 'thumburl' => array(
606 ApiBase::PROP_TYPE => 'string',
607 ApiBase::PROP_NULLABLE => true
608 ),
609 'thumbwidth' => array(
610 ApiBase::PROP_TYPE => 'integer',
611 ApiBase::PROP_NULLABLE => true
612 ),
613 'thumbheight' => array(
614 ApiBase::PROP_TYPE => 'integer',
615 ApiBase::PROP_NULLABLE => true
616 ),
617 'thumberror' => array(
618 ApiBase::PROP_TYPE => 'string',
619 ApiBase::PROP_NULLABLE => true
620 ),
621 'url' => array(
622 ApiBase::PROP_TYPE => 'string',
623 ApiBase::PROP_NULLABLE => true
624 ),
625 'descriptionurl' => array(
626 ApiBase::PROP_TYPE => 'string',
627 ApiBase::PROP_NULLABLE => true
628 )
629 ),
630 'sha1' => array(
631 'filehidden' => 'boolean',
632 'sha1' => array(
633 ApiBase::PROP_TYPE => 'string',
634 ApiBase::PROP_NULLABLE => true
635 )
636 ),
637 'mime' => array(
638 'filehidden' => 'boolean',
639 'mime' => array(
640 ApiBase::PROP_TYPE => 'string',
641 ApiBase::PROP_NULLABLE => true
642 )
643 ),
644 'thumbmime' => array(
645 'filehidden' => 'boolean',
646 'thumbmime' => array(
647 ApiBase::PROP_TYPE => 'string',
648 ApiBase::PROP_NULLABLE => true
649 )
650 ),
651 'mediatype' => array(
652 'filehidden' => 'boolean',
653 'mediatype' => array(
654 ApiBase::PROP_TYPE => 'string',
655 ApiBase::PROP_NULLABLE => true
656 )
657 ),
658 'archivename' => array(
659 'filehidden' => 'boolean',
660 'archivename' => array(
661 ApiBase::PROP_TYPE => 'string',
662 ApiBase::PROP_NULLABLE => true
663 )
664 ),
665 'bitdepth' => array(
666 'filehidden' => 'boolean',
667 'bitdepth' => array(
668 ApiBase::PROP_TYPE => 'integer',
669 ApiBase::PROP_NULLABLE => true
670 )
671 ),
672 );
673 return array_diff_key( $props, array_flip( $filter ) );
674 }
675
676 public function getResultProperties() {
677 return self::getResultPropertiesFiltered();
678 }
679
680 public function getDescription() {
681 return 'Returns image information and upload history';
682 }
683
684 public function getPossibleErrors() {
685 $p = $this->getModulePrefix();
686 return array_merge( parent::getPossibleErrors(), array(
687 array( 'code' => "{$p}urlwidth", 'info' => "{$p}urlheight cannot be used without {$p}urlwidth" ),
688 array( 'code' => 'urlparam', 'info' => "Invalid value for {$p}urlparam" ),
689 array( 'code' => 'urlparam_no_width', 'info' => "{$p}urlparam requires {$p}urlwidth" ),
690 array( 'code' => 'urlparam_urlwidth_mismatch', 'info' => "The width set in {$p}urlparm doesnt't " .
691 "match the one in {$p}urlwidth" ),
692 ) );
693 }
694
695 public function getExamples() {
696 return array(
697 'api.php?action=query&titles=File:Albert%20Einstein%20Head.jpg&prop=imageinfo',
698 'api.php?action=query&titles=File:Test.jpg&prop=imageinfo&iilimit=50&iiend=20071231235959&iiprop=timestamp|user|url',
699 );
700 }
701
702 public function getHelpUrls() {
703 return 'https://www.mediawiki.org/wiki/API:Properties#imageinfo_.2F_ii';
704 }
705 }