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