990130f874fe9806849d6684180190cce981107c
5 * Created on July 6, 2007
7 * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
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.
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.
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
28 * A query action to get image information and upload history.
32 class ApiQueryImageInfo
extends ApiQueryBase
{
33 const TRANSFORM_LIMIT
= 50;
34 private static $transformCount = 0;
36 public function __construct( $query, $moduleName, $prefix = 'ii' ) {
37 // We allow a subclass to override the prefix, to create a related API module.
38 // Some other parts of MediaWiki construct this with a null $prefix, which used to be ignored when this only took two arguments
39 if ( is_null( $prefix ) ) {
42 parent
::__construct( $query, $moduleName, $prefix );
45 public function execute() {
46 $params = $this->extractRequestParams();
48 $prop = array_flip( $params['prop'] );
50 $scale = $this->getScale( $params );
52 $metadataOpts = array(
53 'version' => $params['metadataversion'],
54 'language' => $params['extmetadatalanguage'],
55 'multilang' => $params['extmetadatamultilang'],
58 $pageIds = $this->getPageSet()->getAllTitlesByNamespace();
59 if ( !empty( $pageIds[NS_FILE
] ) ) {
60 $titles = array_keys( $pageIds[NS_FILE
] );
61 asort( $titles ); // Ensure the order is always the same
64 if ( !is_null( $params['continue'] ) ) {
65 $cont = explode( '|', $params['continue'] );
66 $this->dieContinueUsageIf( count( $cont ) != 2 );
67 $fromTitle = strval( $cont[0] );
68 $fromTimestamp = $cont[1];
69 // Filter out any titles before $fromTitle
70 foreach ( $titles as $key => $title ) {
71 if ( $title < $fromTitle ) {
72 unset( $titles[$key] );
79 $result = $this->getResult();
80 //search only inside the local repo
81 if ( $params['localonly'] ) {
82 $images = RepoGroup
::singleton()->getLocalRepo()->findFiles( $titles );
84 $images = RepoGroup
::singleton()->findFiles( $titles );
86 foreach ( $titles as $title ) {
87 $pageId = $pageIds[NS_FILE
][$title];
88 $start = $title === $fromTitle ?
$fromTimestamp : $params['start'];
90 if ( !isset( $images[$title] ) ) {
91 if ( isset( $prop['uploadwarning'] ) ) {
92 // Uploadwarning needs info about non-existing files
93 $images[$title] = wfLocalFile( $title );
96 array( 'query', 'pages', intval( $pageId ) ),
99 // The above can't fail because it doesn't increase the result size
104 /** @var $img File */
105 $img = $images[$title];
107 if ( self
::getTransformCount() >= self
::TRANSFORM_LIMIT
) {
108 if ( count( $pageIds[NS_FILE
] ) == 1 ) {
109 // See the 'the user is screwed' comment below
110 $this->setContinueEnumParameter( 'start',
111 $start !== null ?
$start : wfTimestamp( TS_ISO_8601
, $img->getTimestamp() )
114 $this->setContinueEnumParameter( 'continue',
115 $this->getContinueStr( $img, $start ) );
120 $fit = $result->addValue(
121 array( 'query', 'pages', intval( $pageId ) ),
122 'imagerepository', $img->getRepoName()
125 if ( count( $pageIds[NS_FILE
] ) == 1 ) {
126 // The user is screwed. imageinfo can't be solely
127 // responsible for exceeding the limit in this case,
128 // so set a query-continue that just returns the same
129 // thing again. When the violating queries have been
130 // out-continued, the result will get through
131 $this->setContinueEnumParameter( 'start',
132 $start !== null ?
$start : wfTimestamp( TS_ISO_8601
, $img->getTimestamp() )
135 $this->setContinueEnumParameter( 'continue',
136 $this->getContinueStr( $img, $start ) );
141 // Check if we can make the requested thumbnail, and get transform parameters.
142 $finalThumbParams = $this->mergeThumbParams( $img, $scale, $params['urlparam'] );
144 // Get information about the current version first
145 // Check that the current version is within the start-end boundaries
148 ( is_null( $start ) ||
$img->getTimestamp() <= $start ) &&
149 ( is_null( $params['end'] ) ||
$img->getTimestamp() >= $params['end'] )
153 $fit = $this->addPageSubItem( $pageId,
154 self
::getInfo( $img, $prop, $result,
155 $finalThumbParams, $metadataOpts
159 if ( count( $pageIds[NS_FILE
] ) == 1 ) {
160 // See the 'the user is screwed' comment above
161 $this->setContinueEnumParameter( 'start',
162 wfTimestamp( TS_ISO_8601
, $img->getTimestamp() ) );
164 $this->setContinueEnumParameter( 'continue',
165 $this->getContinueStr( $img ) );
171 // Now get the old revisions
172 // Get one more to facilitate query-continue functionality
173 $count = ( $gotOne ?
1 : 0 );
174 $oldies = $img->getHistory( $params['limit'] - $count +
1, $start, $params['end'] );
175 /** @var $oldie File */
176 foreach ( $oldies as $oldie ) {
177 if ( ++
$count > $params['limit'] ) {
178 // We've reached the extra one which shows that there are additional pages to be had. Stop here...
179 // Only set a query-continue if there was only one title
180 if ( count( $pageIds[NS_FILE
] ) == 1 ) {
181 $this->setContinueEnumParameter( 'start',
182 wfTimestamp( TS_ISO_8601
, $oldie->getTimestamp() ) );
186 $fit = self
::getTransformCount() < self
::TRANSFORM_LIMIT
&&
187 $this->addPageSubItem( $pageId,
188 self
::getInfo( $oldie, $prop, $result,
189 $finalThumbParams, $metadataOpts
193 if ( count( $pageIds[NS_FILE
] ) == 1 ) {
194 $this->setContinueEnumParameter( 'start',
195 wfTimestamp( TS_ISO_8601
, $oldie->getTimestamp() ) );
197 $this->setContinueEnumParameter( 'continue',
198 $this->getContinueStr( $oldie ) );
211 * From parameters, construct a 'scale' array
212 * @param array $params Parameters passed to api.
213 * @return Array or Null: key-val array of 'width' and 'height', or null
215 public function getScale( $params ) {
216 $p = $this->getModulePrefix();
218 if ( $params['urlwidth'] != -1 ) {
220 $scale['width'] = $params['urlwidth'];
221 $scale['height'] = $params['urlheight'];
222 } elseif ( $params['urlheight'] != -1 ) {
223 // Height is specified but width isn't
224 // Don't set $scale['width']; this signals mergeThumbParams() to fill it with the image's width
226 $scale['height'] = $params['urlheight'];
229 if ( $params['urlparam'] ) {
230 $this->dieUsage( "{$p}urlparam requires {$p}urlwidth", "urlparam_no_width" );
237 /** Validate and merge scale parameters with handler thumb parameters, give error if invalid.
239 * We do this later than getScale, since we need the image
240 * to know which handler, since handlers can make their own parameters.
241 * @param File $image Image that params are for.
242 * @param array $thumbParams thumbnail parameters from getScale
243 * @param string $otherParams of otherParams (iiurlparam).
244 * @return Array of parameters for transform.
246 protected function mergeThumbParams( $image, $thumbParams, $otherParams ) {
247 global $wgThumbLimits;
249 if ( !isset( $thumbParams['width'] ) && isset( $thumbParams['height'] ) ) {
250 // We want to limit only by height in this situation, so pass the
251 // image's full width as the limiting width. But some file types
252 // don't have a width of their own, so pick something arbitrary so
253 // thumbnailing the default icon works.
254 if ( $image->getWidth() <= 0 ) {
255 $thumbParams['width'] = max( $wgThumbLimits );
257 $thumbParams['width'] = $image->getWidth();
261 if ( !$otherParams ) {
264 $p = $this->getModulePrefix();
266 $h = $image->getHandler();
268 $this->setWarning( 'Could not create thumbnail because ' .
269 $image->getName() . ' does not have an associated image handler' );
274 $paramList = $h->parseParamString( $otherParams );
276 // Just set a warning (instead of dieUsage), as in many cases
277 // we could still render the image using width and height parameters,
278 // and this type of thing could happen between different versions of
280 $this->setWarning( "Could not parse {$p}urlparam for " . $image->getName()
281 . '. Using only width and height' );
286 if ( isset( $paramList['width'] ) ) {
287 if ( intval( $paramList['width'] ) != intval( $thumbParams['width'] ) ) {
288 $this->setWarning( "Ignoring width value set in {$p}urlparam ({$paramList['width']}) "
289 . "in favor of width value derived from {$p}urlwidth/{$p}urlheight ({$thumbParams['width']})" );
293 foreach ( $paramList as $name => $value ) {
294 if ( !$h->validateParam( $name, $value ) ) {
295 $this->dieUsage( "Invalid value for {$p}urlparam ($name=$value)", "urlparam" );
299 return $thumbParams +
$paramList;
303 * Get result information for an image revision
305 * @param $file File object
306 * @param array $prop of properties to get (in the keys)
307 * @param $result ApiResult object
308 * @param array $thumbParams containing 'width' and 'height' items, or null
309 * @param string|array $metadataOpts Options for metadata fetching.
310 * This is an array consisting of the keys:
311 * 'version': The metadata version for the metadata option
312 * 'language': The language for extmetadata property
313 * 'multilang': Return all translations in extmetadata property
314 * @return Array: result array
316 static function getInfo( $file, $prop, $result, $thumbParams = null, $metadataOpts = false ) {
319 if ( !$metadataOpts ||
is_string( $metadataOpts ) ) {
320 $metadataOpts = array(
321 'version' => $metadataOpts ?
: 'latest',
322 'language' => $wgContLang,
323 'multilang' => false,
326 $version = $metadataOpts['version'];
328 // Timestamp is shown even if the file is revdelete'd in interface
330 if ( isset( $prop['timestamp'] ) ) {
331 $vals['timestamp'] = wfTimestamp( TS_ISO_8601
, $file->getTimestamp() );
334 $user = isset( $prop['user'] );
335 $userid = isset( $prop['userid'] );
337 if ( $user ||
$userid ) {
338 if ( $file->isDeleted( File
::DELETED_USER
) ) {
339 $vals['userhidden'] = '';
342 $vals['user'] = $file->getUser();
345 $vals['userid'] = $file->getUser( 'id' );
347 if ( !$file->getUser( 'id' ) ) {
353 // This is shown even if the file is revdelete'd in interface
355 if ( isset( $prop['size'] ) ||
isset( $prop['dimensions'] ) ) {
356 $vals['size'] = intval( $file->getSize() );
357 $vals['width'] = intval( $file->getWidth() );
358 $vals['height'] = intval( $file->getHeight() );
360 $pageCount = $file->pageCount();
361 if ( $pageCount !== false ) {
362 $vals['pagecount'] = $pageCount;
366 $pcomment = isset( $prop['parsedcomment'] );
367 $comment = isset( $prop['comment'] );
369 if ( $pcomment ||
$comment ) {
370 if ( $file->isDeleted( File
::DELETED_COMMENT
) ) {
371 $vals['commenthidden'] = '';
374 $vals['parsedcomment'] = Linker
::formatComment(
375 $file->getDescription(), $file->getTitle() );
378 $vals['comment'] = $file->getDescription();
383 $url = isset( $prop['url'] );
384 $sha1 = isset( $prop['sha1'] );
385 $meta = isset( $prop['metadata'] );
386 $extmetadata = isset( $prop['extmetadata'] );
387 $mime = isset( $prop['mime'] );
388 $mediatype = isset( $prop['mediatype'] );
389 $archive = isset( $prop['archivename'] );
390 $bitdepth = isset( $prop['bitdepth'] );
391 $uploadwarning = isset( $prop['uploadwarning'] );
393 if ( ( $url ||
$sha1 ||
$meta ||
$mime ||
$mediatype ||
$archive ||
$bitdepth )
394 && $file->isDeleted( File
::DELETED_FILE
)
396 $vals['filehidden'] = '';
398 //Early return, tidier than indenting all following things one level
403 if ( !is_null( $thumbParams ) ) {
404 $mto = $file->transform( $thumbParams );
405 self
::$transformCount++
;
406 if ( $mto && !$mto->isError() ) {
407 $vals['thumburl'] = wfExpandUrl( $mto->getUrl(), PROTO_CURRENT
);
409 // bug 23834 - If the URL's are the same, we haven't resized it, so shouldn't give the wanted
410 // thumbnail sizes for the thumbnail actual size
411 if ( $mto->getUrl() !== $file->getUrl() ) {
412 $vals['thumbwidth'] = intval( $mto->getWidth() );
413 $vals['thumbheight'] = intval( $mto->getHeight() );
415 $vals['thumbwidth'] = intval( $file->getWidth() );
416 $vals['thumbheight'] = intval( $file->getHeight() );
419 if ( isset( $prop['thumbmime'] ) && $file->getHandler() ) {
420 list( , $mime ) = $file->getHandler()->getThumbType(
421 $mto->getExtension(), $file->getMimeType(), $thumbParams );
422 $vals['thumbmime'] = $mime;
424 } elseif ( $mto && $mto->isError() ) {
425 $vals['thumberror'] = $mto->toText();
428 $vals['url'] = wfExpandUrl( $file->getFullURL(), PROTO_CURRENT
);
429 $vals['descriptionurl'] = wfExpandUrl( $file->getDescriptionUrl(), PROTO_CURRENT
);
433 $vals['sha1'] = wfBaseConvert( $file->getSha1(), 36, 16, 40 );
437 wfSuppressWarnings();
438 $metadata = unserialize( $file->getMetadata() );
440 if ( $metadata && $version !== 'latest' ) {
441 $metadata = $file->convertMetadataVersion( $metadata, $version );
443 $vals['metadata'] = $metadata ? self
::processMetaData( $metadata, $result ) : null;
446 if ( $extmetadata ) {
447 // Note, this should return an array where all the keys
448 // start with a letter, and all the values are strings.
449 // Thus there should be no issue with format=xml.
450 $format = new FormatMetadata
;
451 $format->setSingleLanguage( !$metadataOpts['multilang'] );
452 $format->getContext()->setLanguage( $metadataOpts['language'] );
453 $extmetaArray = $format->fetchExtendedMetadata( $file );
454 $vals['extmetadata'] = $extmetaArray;
458 $vals['mime'] = $file->getMimeType();
462 $vals['mediatype'] = $file->getMediaType();
465 if ( $archive && $file->isOld() ) {
466 $vals['archivename'] = $file->getArchiveName();
470 $vals['bitdepth'] = $file->getBitDepth();
473 if ( $uploadwarning ) {
474 $vals['html'] = SpecialUpload
::getExistsWarning( UploadBase
::getExistsWarning( $file ) );
481 * Get the count of image transformations performed
483 * If this is >= TRANSFORM_LIMIT, you should probably stop processing images.
485 * @return integer count
487 static function getTransformCount() {
488 return self
::$transformCount;
493 * @param $metadata Array
494 * @param $result ApiResult
497 public static function processMetaData( $metadata, $result ) {
499 if ( is_array( $metadata ) ) {
500 foreach ( $metadata as $key => $value ) {
501 $r = array( 'name' => $key );
502 if ( is_array( $value ) ) {
503 $r['value'] = self
::processMetaData( $value, $result );
505 $r['value'] = $value;
510 $result->setIndexedTagName( $retval, 'metadata' );
515 public function getCacheMode( $params ) {
521 * @param null|string $start
524 protected function getContinueStr( $img, $start = null ) {
525 if ( $start === null ) {
526 $start = $img->getTimestamp();
529 return $img->getOriginalTitle()->getDBkey() . '|' . $start;
532 public function getAllowedParams() {
537 ApiBase
::PARAM_ISMULTI
=> true,
538 ApiBase
::PARAM_DFLT
=> 'timestamp|user',
539 ApiBase
::PARAM_TYPE
=> self
::getPropertyNames()
542 ApiBase
::PARAM_TYPE
=> 'limit',
543 ApiBase
::PARAM_DFLT
=> 1,
544 ApiBase
::PARAM_MIN
=> 1,
545 ApiBase
::PARAM_MAX
=> ApiBase
::LIMIT_BIG1
,
546 ApiBase
::PARAM_MAX2
=> ApiBase
::LIMIT_BIG2
549 ApiBase
::PARAM_TYPE
=> 'timestamp'
552 ApiBase
::PARAM_TYPE
=> 'timestamp'
555 ApiBase
::PARAM_TYPE
=> 'integer',
556 ApiBase
::PARAM_DFLT
=> -1
558 'urlheight' => array(
559 ApiBase
::PARAM_TYPE
=> 'integer',
560 ApiBase
::PARAM_DFLT
=> -1
562 'metadataversion' => array(
563 ApiBase
::PARAM_TYPE
=> 'string',
564 ApiBase
::PARAM_DFLT
=> '1',
566 'extmetadatalanguage' => array(
567 ApiBase
::PARAM_TYPE
=> 'string',
568 ApiBase
::PARAM_DFLT
=> $wgContLang->getCode(),
570 'extmetadatamultilang' => array(
571 ApiBase
::PARAM_TYPE
=> 'boolean',
572 ApiBase
::PARAM_DFLT
=> false,
575 ApiBase
::PARAM_DFLT
=> '',
576 ApiBase
::PARAM_TYPE
=> 'string',
579 'localonly' => false,
584 * Returns all possible parameters to iiprop
586 * @param array $filter List of properties to filter out
590 public static function getPropertyNames( $filter = array() ) {
591 return array_diff( array_keys( self
::getProperties() ), $filter );
595 * Returns array key value pairs of properties and their descriptions
597 * @param string $modulePrefix
600 private static function getProperties( $modulePrefix = '' ) {
602 'timestamp' => ' timestamp - Adds timestamp for the uploaded version',
603 'user' => ' user - Adds the user who uploaded the image version',
604 'userid' => ' userid - Add the user ID that uploaded the image version',
605 'comment' => ' comment - Comment on the version',
606 'parsedcomment' => ' parsedcomment - Parse the comment on the version',
607 'url' => ' url - Gives URL to the image and the description page',
608 'size' => ' size - Adds the size of the image in bytes and the height, width and page count (if applicable)',
609 'dimensions' => ' dimensions - Alias for size', // For backwards compatibility with Allimages
610 'sha1' => ' sha1 - Adds SHA-1 hash for the image',
611 'mime' => ' mime - Adds MIME type of the image',
612 'thumbmime' => ' thumbmime - Adds MIME type of the image thumbnail' .
613 ' (requires url and param ' . $modulePrefix . 'urlwidth)',
614 'mediatype' => ' mediatype - Adds the media type of the image',
615 'metadata' => ' metadata - Lists Exif metadata for the version of the image',
616 'extmetadata' => ' extmetadata - Lists formatted metadata combined from multiple sources. Results are HTML formatted.',
617 'archivename' => ' archivename - Adds the file name of the archive version for non-latest versions',
618 'bitdepth' => ' bitdepth - Adds the bit depth of the version',
619 'uploadwarning' => ' uploadwarning - Used by the Special:Upload page to get information about an existing file. Not intended for use outside MediaWiki core',
624 * Returns the descriptions for the properties provided by getPropertyNames()
626 * @param array $filter List of properties to filter out
627 * @param string $modulePrefix
630 public static function getPropertyDescriptions( $filter = array(), $modulePrefix = '' ) {
632 array( 'What image information to get:' ),
633 array_values( array_diff_key( self
::getProperties( $modulePrefix ), array_flip( $filter ) ) )
638 * Return the API documentation for the parameters.
639 * @return Array parameter documentation.
641 public function getParamDescription() {
642 $p = $this->getModulePrefix();
645 'prop' => self
::getPropertyDescriptions( array(), $p ),
646 'urlwidth' => array( "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.",
647 'For performance reasons if this option is used, ' .
648 'no more than ' . self
::TRANSFORM_LIMIT
. ' scaled images will be returned.' ),
649 'urlheight' => "Similar to {$p}urlwidth.",
650 'urlparam' => array( "A handler specific parameter string. For example, pdf's ",
651 "might use 'page15-100px'. {$p}urlwidth must be used and be consistent with {$p}urlparam" ),
652 'limit' => 'How many image revisions to return per image',
653 'start' => 'Timestamp to start listing from',
654 'end' => 'Timestamp to stop listing at',
655 'metadataversion' => array( "Version of metadata to use. if 'latest' is specified, use latest version.",
656 "Defaults to '1' for backwards compatibility" ),
657 'extmetadatalanguage' => array( 'What language to fetch extmetadata in. This affects both which',
658 'translation to fetch, if multiple are available, as well as how things',
659 'like numbers and various values are formatted.' ),
660 'extmetadatamultilang' => 'If translations for extmetadata property are available, fetch all of them.',
661 'continue' => 'If the query response includes a continue value, use it here to get another page of results',
662 'localonly' => 'Look only for files in the local repository',
666 public static function getResultPropertiesFiltered( $filter = array() ) {
668 'timestamp' => array(
669 'timestamp' => 'timestamp'
672 'userhidden' => 'boolean',
677 'userhidden' => 'boolean',
678 'userid' => 'integer',
683 'width' => 'integer',
684 'height' => 'integer',
685 'pagecount' => array(
686 ApiBase
::PROP_TYPE
=> 'integer',
687 ApiBase
::PROP_NULLABLE
=> true
690 'dimensions' => array(
692 'width' => 'integer',
693 'height' => 'integer',
694 'pagecount' => array(
695 ApiBase
::PROP_TYPE
=> 'integer',
696 ApiBase
::PROP_NULLABLE
=> true
700 'commenthidden' => 'boolean',
702 ApiBase
::PROP_TYPE
=> 'string',
703 ApiBase
::PROP_NULLABLE
=> true
706 'parsedcomment' => array(
707 'commenthidden' => 'boolean',
708 'parsedcomment' => array(
709 ApiBase
::PROP_TYPE
=> 'string',
710 ApiBase
::PROP_NULLABLE
=> true
714 'filehidden' => 'boolean',
716 ApiBase
::PROP_TYPE
=> 'string',
717 ApiBase
::PROP_NULLABLE
=> true
719 'thumbwidth' => array(
720 ApiBase
::PROP_TYPE
=> 'integer',
721 ApiBase
::PROP_NULLABLE
=> true
723 'thumbheight' => array(
724 ApiBase
::PROP_TYPE
=> 'integer',
725 ApiBase
::PROP_NULLABLE
=> true
727 'thumberror' => array(
728 ApiBase
::PROP_TYPE
=> 'string',
729 ApiBase
::PROP_NULLABLE
=> true
732 ApiBase
::PROP_TYPE
=> 'string',
733 ApiBase
::PROP_NULLABLE
=> true
735 'descriptionurl' => array(
736 ApiBase
::PROP_TYPE
=> 'string',
737 ApiBase
::PROP_NULLABLE
=> true
741 'filehidden' => 'boolean',
743 ApiBase
::PROP_TYPE
=> 'string',
744 ApiBase
::PROP_NULLABLE
=> true
748 'filehidden' => 'boolean',
750 ApiBase
::PROP_TYPE
=> 'string',
751 ApiBase
::PROP_NULLABLE
=> true
754 'thumbmime' => array(
755 'filehidden' => 'boolean',
756 'thumbmime' => array(
757 ApiBase
::PROP_TYPE
=> 'string',
758 ApiBase
::PROP_NULLABLE
=> true
761 'mediatype' => array(
762 'filehidden' => 'boolean',
763 'mediatype' => array(
764 ApiBase
::PROP_TYPE
=> 'string',
765 ApiBase
::PROP_NULLABLE
=> true
768 'archivename' => array(
769 'filehidden' => 'boolean',
770 'archivename' => array(
771 ApiBase
::PROP_TYPE
=> 'string',
772 ApiBase
::PROP_NULLABLE
=> true
776 'filehidden' => 'boolean',
778 ApiBase
::PROP_TYPE
=> 'integer',
779 ApiBase
::PROP_NULLABLE
=> true
784 return array_diff_key( $props, array_flip( $filter ) );
787 public function getResultProperties() {
788 return self
::getResultPropertiesFiltered();
791 public function getDescription() {
792 return 'Returns image information and upload history';
795 public function getPossibleErrors() {
796 $p = $this->getModulePrefix();
798 return array_merge( parent
::getPossibleErrors(), array(
799 array( 'code' => "{$p}urlwidth", 'info' => "{$p}urlheight cannot be used without {$p}urlwidth" ),
800 array( 'code' => 'urlparam', 'info' => "Invalid value for {$p}urlparam" ),
801 array( 'code' => 'urlparam_no_width', 'info' => "{$p}urlparam requires {$p}urlwidth" ),
805 public function getExamples() {
807 'api.php?action=query&titles=File:Albert%20Einstein%20Head.jpg&prop=imageinfo',
808 'api.php?action=query&titles=File:Test.jpg&prop=imageinfo&iilimit=50&iiend=20071231235959&iiprop=timestamp|user|url',
812 public function getHelpUrls() {
813 return 'https://www.mediawiki.org/wiki/API:Properties#imageinfo_.2F_ii';