<?php
/**
- *
- *
- * Created on July 6, 2007
- *
* Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
*
* This program is free software; you can redistribute it and/or modify
}
}
- /** @var $img File */
+ /** @var File $img */
$img = $images[$title];
if ( self::getTransformCount() >= self::TRANSFORM_LIMIT ) {
// Get one more to facilitate query-continue functionality
$count = ( $gotOne ? 1 : 0 );
$oldies = $img->getHistory( $params['limit'] - $count + 1, $start, $params['end'] );
- /** @var $oldie File */
+ /** @var File $oldie */
foreach ( $oldies as $oldie ) {
if ( ++$count > $params['limit'] ) {
// We've reached the extra one which shows that there are
}
if ( $url ) {
- if ( !is_null( $thumbParams ) ) {
- $mto = $file->transform( $thumbParams );
- self::$transformCount++;
- if ( $mto && !$mto->isError() ) {
- $vals['thumburl'] = wfExpandUrl( $mto->getUrl(), PROTO_CURRENT );
-
- // T25834 - If the URLs are the same, we haven't resized it, so shouldn't give the wanted
- // thumbnail sizes for the thumbnail actual size
- if ( $mto->getUrl() !== $file->getUrl() ) {
- $vals['thumbwidth'] = intval( $mto->getWidth() );
- $vals['thumbheight'] = intval( $mto->getHeight() );
- } else {
- $vals['thumbwidth'] = intval( $file->getWidth() );
- $vals['thumbheight'] = intval( $file->getHeight() );
- }
+ if ( $file->exists() ) {
+ if ( !is_null( $thumbParams ) ) {
+ $mto = $file->transform( $thumbParams );
+ self::$transformCount++;
+ if ( $mto && !$mto->isError() ) {
+ $vals['thumburl'] = wfExpandUrl( $mto->getUrl(), PROTO_CURRENT );
+
+ // T25834 - If the URLs are the same, we haven't resized it, so shouldn't give the wanted
+ // thumbnail sizes for the thumbnail actual size
+ if ( $mto->getUrl() !== $file->getUrl() ) {
+ $vals['thumbwidth'] = intval( $mto->getWidth() );
+ $vals['thumbheight'] = intval( $mto->getHeight() );
+ } else {
+ $vals['thumbwidth'] = intval( $file->getWidth() );
+ $vals['thumbheight'] = intval( $file->getHeight() );
+ }
- if ( isset( $prop['thumbmime'] ) && $file->getHandler() ) {
- list( , $mime ) = $file->getHandler()->getThumbType(
- $mto->getExtension(), $file->getMimeType(), $thumbParams );
- $vals['thumbmime'] = $mime;
+ if ( isset( $prop['thumbmime'] ) && $file->getHandler() ) {
+ list( , $mime ) = $file->getHandler()->getThumbType(
+ $mto->getExtension(), $file->getMimeType(), $thumbParams );
+ $vals['thumbmime'] = $mime;
+ }
+ } elseif ( $mto && $mto->isError() ) {
+ $vals['thumberror'] = $mto->toText();
}
- } elseif ( $mto && $mto->isError() ) {
- $vals['thumberror'] = $mto->toText();
}
+ $vals['url'] = wfExpandUrl( $file->getFullUrl(), PROTO_CURRENT );
+ } else {
+ $vals['filemissing'] = true;
}
- $vals['url'] = wfExpandUrl( $file->getFullUrl(), PROTO_CURRENT );
$vals['descriptionurl'] = wfExpandUrl( $file->getDescriptionUrl(), PROTO_CURRENT );
$shortDescriptionUrl = $file->getDescriptionShortUrl();
}
if ( $meta ) {
- MediaWiki\suppressWarnings();
+ Wikimedia\suppressWarnings();
$metadata = unserialize( $file->getMetadata() );
- MediaWiki\restoreWarnings();
+ Wikimedia\restoreWarnings();
if ( $metadata && $version !== 'latest' ) {
$metadata = $file->convertMetadataVersion( $metadata, $version );
}
*/
private static function getProperties( $modulePrefix = '' ) {
return [
- 'timestamp' => ' timestamp - Adds timestamp for the uploaded version',
- 'user' => ' user - Adds the user who uploaded the image version',
- 'userid' => ' userid - Add the user ID that uploaded the image version',
- 'comment' => ' comment - Comment on the version',
- 'parsedcomment' => ' parsedcomment - Parse the comment on the version',
+ 'timestamp' => ' timestamp - Adds timestamp for the uploaded version',
+ 'user' => ' user - Adds the user who uploaded the image version',
+ 'userid' => ' userid - Add the user ID that uploaded the image version',
+ 'comment' => ' comment - Comment on the version',
+ 'parsedcomment' => ' parsedcomment - Parse the comment on the version',
'canonicaltitle' => ' canonicaltitle - Adds the canonical title of the image file',
- 'url' => ' url - Gives URL to the image and the description page',
- 'size' => ' size - Adds the size of the image in bytes, ' .
+ 'url' => ' url - Gives URL to the image and the description page',
+ 'size' => ' size - Adds the size of the image in bytes, ' .
'its height and its width. Page count and duration are added if applicable',
- 'dimensions' => ' dimensions - Alias for size', // B/C with Allimages
- 'sha1' => ' sha1 - Adds SHA-1 hash for the image',
- 'mime' => ' mime - Adds MIME type of the image',
- 'thumbmime' => ' thumbmime - Adds MIME type of the image thumbnail' .
+ 'dimensions' => ' dimensions - Alias for size', // B/C with Allimages
+ 'sha1' => ' sha1 - Adds SHA-1 hash for the image',
+ 'mime' => ' mime - Adds MIME type of the image',
+ 'thumbmime' => ' thumbmime - Adds MIME type of the image thumbnail' .
' (requires url and param ' . $modulePrefix . 'urlwidth)',
- 'mediatype' => ' mediatype - Adds the media type of the image',
- 'metadata' => ' metadata - Lists Exif metadata for the version of the image',
+ 'mediatype' => ' mediatype - Adds the media type of the image',
+ 'metadata' => ' metadata - Lists Exif metadata for the version of the image',
'commonmetadata' => ' commonmetadata - Lists file format generic metadata ' .
'for the version of the image',
- 'extmetadata' => ' extmetadata - Lists formatted metadata combined ' .
+ 'extmetadata' => ' extmetadata - Lists formatted metadata combined ' .
'from multiple sources. Results are HTML formatted.',
- 'archivename' => ' archivename - Adds the file name of the archive ' .
+ 'archivename' => ' archivename - Adds the file name of the archive ' .
'version for non-latest versions',
- 'bitdepth' => ' bitdepth - Adds the bit depth of the version',
- 'uploadwarning' => ' uploadwarning - Used by the Special:Upload page to ' .
+ 'bitdepth' => ' bitdepth - Adds the bit depth of the version',
+ 'uploadwarning' => ' uploadwarning - Used by the Special:Upload page to ' .
'get information about an existing file. Not intended for use outside MediaWiki core',
];
}