8use Wikimedia\AtEase\AtEase;
196 if ( $ret instanceof
Title ) {
197 # Normalize NS_MEDIA -> NS_FILE
198 if ( $ret->getNamespace() ==
NS_MEDIA ) {
199 $ret = Title::makeTitleSafe(
NS_FILE, $ret->getDBkey() );
200 # Sanity check the title namespace
201 } elseif ( $ret->getNamespace() !==
NS_FILE ) {
205 # Convert strings to Title objects
206 $ret = Title::makeTitleSafe(
NS_FILE, (
string)$ret );
208 if ( !$ret && $exception !==
false ) {
209 throw new MWException(
"`$title` is not a valid file title." );
216 $function = [ $this,
'get' . ucfirst(
$name ) ];
217 if ( !is_callable( $function ) ) {
220 $this->
$name = $function();
242 if ( isset( $squish[$lower] ) ) {
243 return $squish[$lower];
244 } elseif ( preg_match(
'/^[0-9a-z]+$/', $lower ) ) {
261 $n = strrpos( $new,
'.' );
263 $mimeMagic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
265 return $mimeMagic->isMatchingExtension( $newExt, $oldMime );
284 if ( strpos( $mime,
'/' ) !==
false ) {
285 return explode(
'/', $mime, 2 );
287 return [ $mime,
'unknown' ];
308 if ( $this->name ===
null ) {
310 $this->name = $this->repo->getNameFromTitle( $this->title );
322 if ( !isset( $this->extension ) ) {
323 $n = strrpos( $this->
getName(),
'.' );
325 $n ? substr( $this->
getName(), $n + 1 ) :
'' );
346 if ( $this->redirected ) {
359 if ( !isset( $this->url ) ) {
362 $this->url = $this->repo->getZoneUrl(
'public',
$ext ) .
'/' . $this->
getUrlRel();
404 wfDebug( __METHOD__ .
': supposed to render ' . $this->
getName() .
407 return $this->
getUrl(); # hm...
return NULL?
428 if ( !isset( $this->path ) ) {
430 $this->path = $this->repo->getZonePath(
'public' ) .
'/' . $this->
getRel();
445 if ( !isset( $this->fsFile ) ) {
447 $this->fsFile = $this->repo->getLocalReference( $this->
getPath() );
450 MediaWikiServices::getInstance()->getStatsdDataFactory()->timing(
451 'media.thumbnail.generate.fetchoriginal', 1000 * $statTiming );
453 if ( !$this->fsFile ) {
454 $this->fsFile =
false;
458 return ( $this->fsFile )
459 ? $this->fsFile->getPath()
503 $imageWidth = $this->
getWidth( $page );
505 if ( $imageWidth ===
false ) {
509 if ( $desiredWidth > $imageWidth ) {
519 sort( $sortedBuckets );
521 foreach ( $sortedBuckets as $bucket ) {
522 if ( $bucket >= $imageWidth ) {
605 $userPreferredLanguage,
693 if ( !is_array( $metadata ) ) {
732 return 'unknown/unknown';
785 return $this->
getHandler() && $this->handler->mustRender( $this );
844 # wfDebug( "LocalFile::isSafeFile: type= $type, mime= $mime\n" );
847 return false; # unknown type, not trusted
853 if ( $mime ===
"unknown/unknown" ) {
854 return false; # unknown type, not trusted
877 # this could be implemented to check a flag in the database,
878 # look for signatures, etc
891 public function load( $flags = 0 ) {
902 return $this->
getPath() && $this->repo->fileExists( $this->path );
919 if ( !isset( $this->transformScript ) ) {
920 $this->transformScript =
false;
922 $script = $this->repo->getThumbScriptUrl();
940 $hp =& $handlerParams;
941 $page = $hp[
'page'] ??
false;
946 $hp[
'width'] = $width;
948 unset( $hp[
'height'] );
964 ? $this->repo->nameForThumb( $this->
getName() )
982 list( $thumbExt, ) = $this->
getHandler()->getThumbType(
984 $thumbName = $this->
getHandler()->makeParamString( $params );
986 if ( $this->repo->supportsSha1URLs() ) {
987 $thumbName .=
'-' . $this->
getSha1() .
'.' . $thumbExt;
989 $thumbName .=
'-' .
$name;
992 $thumbName .=
".$thumbExt";
1017 $params = [
'width' => $width ];
1018 if ( $height != -1 ) {
1019 $params[
'height'] = $height;
1022 if ( !$thumb || $thumb->isError() ) {
1026 return $thumb->getUrl();
1042 if (
$handler && $wgIgnoreImageErrors && !( $flags & self::RENDER_NOW ) ) {
1046 $params[
'width'], 0,
wfMessage(
'thumbnail-dest-create' ) );
1069 if ( $descriptionUrl ) {
1075 if ( $script && !( $flags & self::RENDER_NOW ) ) {
1083 $normalisedParams = $params;
1086 $thumbName = $this->
thumbName( $normalisedParams );
1090 if ( $this->repo ) {
1092 if ( $this->repo->canTransformVia404() && !( $flags & self::RENDER_NOW ) ) {
1100 wfDebug( __METHOD__ .
": Doing stat for $thumbPath\n" );
1101 if ( !( $flags & self::RENDER_FORCE ) && $this->repo->fileExists( $thumbPath ) ) {
1102 $timestamp = $this->repo->getFileTimestamp( $thumbPath );
1108 $thumb->setStoragePath( $thumbPath );
1111 } elseif ( $flags & self::RENDER_FORCE ) {
1112 wfDebug( __METHOD__ .
" forcing rendering per flag File::RENDER_FORCE\n" );
1117 if ( $this->repo->getReadOnlyReason() !==
false ) {
1132 return is_object( $thumb ) ? $thumb :
false;
1145 $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
1149 $normalisedParams = $transformParams;
1152 $thumbName = $this->
thumbName( $normalisedParams );
1156 $tmpThumbPath = $tmpFile->getPath();
1166 $tmpFile->bind( $thumb );
1168 $statTiming = microtime(
true ) -
$starttime;
1169 $stats->timing(
'media.thumbnail.generate.transform', 1000 * $statTiming );
1173 } elseif ( $thumb->isError() ) {
1175 '@phan-var MediaTransformError $thumb';
1176 $this->lastError = $thumb->toText();
1181 } elseif ( $this->repo && $thumb->hasFile() && !$thumb->fileIsSource() ) {
1187 $status = $this->repo->quickImport( $tmpThumbPath, $thumbPath, $disposition );
1188 if ( $status->isOK() ) {
1189 $thumb->setStoragePath( $thumbPath );
1194 $statTiming = microtime(
true ) -
$starttime;
1195 $stats->timing(
'media.thumbnail.generate.store', 1000 * $statTiming );
1198 Hooks::run(
'FileTransformed', [ $this, $thumb, $tmpThumbPath, $thumbPath ] );
1212 || !isset( $params[
'physicalWidth'] )
1213 || !isset( $params[
'physicalHeight'] )
1220 if ( !$bucket || $bucket == $params[
'physicalWidth'] ) {
1226 if ( $this->repo->fileExists( $bucketPath ) ) {
1232 $params[
'physicalWidth'] = $bucket;
1233 $params[
'width'] = $bucket;
1235 $params = $this->
getHandler()->sanitizeParamsForBucketing( $params );
1245 $buckettime = microtime(
true ) -
$starttime;
1247 if ( !$thumb || $thumb->isError() ) {
1251 $this->tmpBucketedThumbCache[$bucket] = $tmpFile->getPath();
1254 $tmpFile->bind( $this );
1256 MediaWikiServices::getInstance()->getStatsdDataFactory()->timing(
1257 'media.thumbnail.generate.bucket', 1000 * $buckettime );
1270 && isset( $params[
'physicalWidth'] )
1280 if ( isset( $this->tmpBucketedThumbCache[$bucket] ) ) {
1281 $tmpPath = $this->tmpBucketedThumbCache[$bucket];
1283 if ( file_exists( $tmpPath ) ) {
1287 'height' => $bucketHeight
1294 if ( $this->repo->fileExists( $bucketPath ) ) {
1295 $fsFile = $this->repo->getLocalReference( $bucketPath );
1301 'height' => $bucketHeight
1309 if ( $this->
getSize() >= 1e7 ) {
1312 'doWork' =>
function () {
1346 return $this->
thumbName( [
'physicalWidth' => $bucket ] );
1356 return MediaWikiServices::getInstance()->getTempFSFileFactory()
1357 ->newTempFSFile(
'transform_', $thumbExt );
1368 if ( $thumbExt !=
'' && $thumbExt !== $this->
getExtension() ) {
1369 $fileName .=
".$thumbExt";
1391 if ( !isset( $this->handler ) ) {
1405 $assetsPath =
"$wgResourceBasePath/resources/assets/file-type-icons/";
1406 $assetsDirectory =
"$IP/resources/assets/file-type-icons/";
1408 $try = [
'fileicon-' . $this->
getExtension() .
'.png',
'fileicon.png' ];
1409 foreach ( $try as $icon ) {
1410 if ( file_exists( $assetsDirectory . $icon ) ) {
1411 $params = [
'width' => 120,
'height' => 120 ];
1413 return new ThumbnailImage( $this, $assetsPath . $icon,
false, $params );
1476 [
'causeAction' =>
'file-purge' ]
1478 JobQueueGroup::singleton()->lazyPush(
$job );
1493 function getHistory( $limit =
null, $start =
null, $end =
null, $inc =
true ) {
1527 if ( $this->hashPath ===
null ) {
1529 $this->hashPath = $this->repo->getHashPath( $this->
getName() );
1554 if ( $suffix ===
false ) {
1572 if ( $suffix !==
false ) {
1573 $path .=
'/' . $suffix;
1599 if ( $suffix !==
false ) {
1600 $path .=
'/' . $suffix;
1615 return $this->repo->getZonePath(
'public' ) .
'/' . $this->
getArchiveRel( $suffix );
1628 return $this->repo->getZonePath(
'thumb' ) .
'/' .
1641 return $this->repo->getZonePath(
'thumb' ) .
'/' . $this->
getThumbRel( $suffix );
1653 return $this->repo->getZonePath(
'transcoded' ) .
'/' . $this->
getThumbRel( $suffix );
1666 if ( $suffix ===
false ) {
1669 $path .= rawurlencode( $suffix );
1685 $path = $this->repo->getZoneUrl(
'thumb',
$ext ) .
'/archive/' .
1686 $this->
getHashPath() . rawurlencode( $archiveName );
1687 if ( $suffix !==
false ) {
1688 $path .=
'/' . rawurlencode( $suffix );
1705 if ( $suffix !==
false ) {
1706 $path .=
'/' . rawurlencode( $suffix );
1719 return $this->
getZoneUrl(
'thumb', $suffix );
1729 return $this->
getZoneUrl(
'transcoded', $suffix );
1740 $path = $this->repo->getVirtualUrl() .
'/public/' . $this->
getUrlRel();
1741 if ( $suffix !==
false ) {
1742 $path .=
'/' . rawurlencode( $suffix );
1756 $path = $this->repo->getVirtualUrl() .
'/public/archive/' . $this->
getHashPath();
1757 if ( $suffix ===
false ) {
1760 $path .= rawurlencode( $suffix );
1774 $path = $this->repo->getVirtualUrl() .
'/thumb/' . $this->
getUrlRel();
1775 if ( $suffix !==
false ) {
1776 $path .=
'/' . rawurlencode( $suffix );
1788 return (
bool)$this->repo->getHashLevels();
1795 throw new MWException( static::class .
': write operations are not supported' );
1814 $watch =
false, $timestamp =
false,
User $user =
null
1840 function publish( $src, $flags = 0, array $options = [] ) {
1862 return $this->repo && $this->repo->isLocal();
1871 return $this->repo ? $this->repo->getName() :
'unknown';
1955 function delete( $reason, $suppress =
false, $user = null ) {
1972 function restore( $versions = [], $unsuppress =
false ) {
1984 return $this->
getHandler() && $this->handler->isMultiPage( $this );
1995 if ( $this->
getHandler() && $this->handler->isMultiPage( $this ) ) {
1996 $this->
pageCount = $this->handler->pageCount( $this );
2016 if ( $srcWidth == 0 ) {
2019 return (
int)round( $srcHeight * $dstWidth / $srcWidth );
2038 return $this->
getHandler()->getImageSize( $this, $filePath );
2048 if ( $this->repo ) {
2049 return $this->repo->getDescriptionUrl( $this->
getName() );
2064 if ( !$this->repo || !$this->repo->fetchDescription ) {
2070 $renderUrl = $this->repo->getDescriptionRenderUrl( $this->
getName(),
$lang->getCode() );
2072 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
2073 $key = $this->repo->getLocalCacheKey(
2074 'RemoteFileDescription',
2078 $fname = __METHOD__;
2080 return $cache->getWithSetCallback(
2082 $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
2083 function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl, $fname ) {
2084 wfDebug(
"Fetching shared description from $renderUrl\n" );
2085 $res = MediaWikiServices::getInstance()->getHttpRequestFactory()->
2086 get( $renderUrl, [], $fname );
2088 $ttl = WANObjectCache::TTL_UNCACHEABLE;
2123 return $this->repo->getFileTimestamp( $this->
getPath() );
2145 return $this->repo->getFileSha1( $this->
getPath() );
2159 $dotExt =
$ext ===
'' ?
'' :
".$ext";
2161 return $hash . $dotExt;
2185 if ( is_string( $metadata ) ) {
2186 $metadata = AtEase::quietCall(
'unserialize', $metadata );
2189 if ( !is_array( $metadata ) ) {
2246 if ( $this->redirected ) {
2247 if ( !$this->redirectTitle ) {
2248 $this->redirectTitle = Title::makeTitle(
NS_FILE, $this->redirected );
2262 $this->redirected = $from;
2285 if ( !( $this->repo instanceof $this->repoClass ) ) {
2286 throw new MWException(
"A {$this->repoClass} object is not set for this File.\n" );
2295 if ( !( $this->title instanceof
Title ) ) {
2296 throw new MWException(
"A Title object is not set for this File.\n" );
unserialize( $serialized)
$wgIgnoreImageErrors
If set, inline scaled images will still produce "<img>" tags ready for output instead of showing an e...
$wgThumbnailBuckets
When defined, is an array of image widths used as buckets for thumbnail generation.
$wgThumbnailMinimumBucketDistance
When using thumbnail buckets as defined above, this sets the minimum distance to the bucket above the...
$wgResourceBasePath
The default 'remoteBasePath' value for instances of ResourceLoaderFileModule.
$wgThumbnailEpoch
If rendered thumbnail files are older than this timestamp, they will be rerendered on demand as if th...
$wgTrustedMediaFormats
list of trusted media-types and MIME types.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Class representing a non-directory file on the file system.
getPath()
Returns the file system path.
static extensionFromPath( $path, $case='lowercase')
Get the final extension from a storage or FS path.
static makeContentDisposition( $type, $filename='')
Build a Content-Disposition header value per RFC 6266.
Base class for file repositories.
Implements some public methods and some protected utility functions which are required by multiple ch...
getStorageKey()
Get the deletion archive key, "<sha1>.<ext>".
string $url
The URL corresponding to one of the four basic zones.
getVisibility()
Return the deletion bitfield STUB.
isVectorized()
Return true if the file is vectorized.
recordUpload( $oldver, $desc, $license='', $copyStatus='', $source='', $watch=false, $timestamp=false, User $user=null)
Record a file upload in the upload log and the image table STUB Overridden by LocalFile.
restore( $versions=[], $unsuppress=false)
Restore all or specified deleted revisions to the given file.
isExpensiveToThumbnail()
True if creating thumbnails from the file is large or otherwise resource-intensive.
isLocal()
Returns true if the file comes from the local file repository.
getThumbRel( $suffix=false)
Get the path, relative to the thumbnail zone root, of the thumbnail directory or a particular file if...
getLastError()
Get last thumbnailing error.
generateAndSaveThumb( $tmpFile, $transformParams, $flags)
Generates a thumbnail according to the given parameters and saves it to storage.
purgeDescription()
Purge the file description page, but don't go after pages using the file.
__construct( $title, $repo)
Call this constructor from child classes.
getIsSafeFileUncached()
Uncached accessor.
getArchivePath( $suffix=false)
Get the path of the archived file.
getBucketThumbName( $bucket)
Returns the name of the thumb for a given bucket.
FSFile bool $fsFile
False if undefined.
const RENDER_NOW
Force rendering in the current process.
getPath()
Return the storage path to the file.
getThumbPath( $suffix=false)
Get the path of the thumbnail directory, or a particular file if $suffix is specified.
getThumbVirtualUrl( $suffix=false)
Get the virtual URL for a thumbnail file or directory.
getIsSafeFile()
Accessor for __get()
getDescriptionTouched()
Returns the timestamp (in TS_MW format) of the last change of the description page.
transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags)
Return either a MediaTransformError or placeholder thumbnail (if $wgIgnoreImageErrors)
array $tmpBucketedThumbCache
Cache of tmp filepaths pointing to generated bucket thumbnails, keyed by width.
getMimeType()
Returns the MIME type of the file.
getSize()
Return the size of the image file, in bytes Overridden by LocalFile, UnregisteredLocalFile STUB.
string $extension
File extension.
pageCount()
Returns the number of pages of a multipage document, or false for documents which aren't multipage do...
getMediaType()
Return the type of the media in the file.
string $redirected
Main part of the title, with underscores (Title::getDBkey)
getTranscodedUrl( $suffix=false)
Get the URL of the transcoded directory, or a particular file if $suffix is specified.
bool $isSafeFile
Whether this media file is in a format that is unlikely to contain viruses or malicious content.
getRel()
Get the path of the file relative to the public zone root.
getLength()
Get the duration of a media file in seconds.
static normalizeTitle( $title, $exception=false)
Given a string or Title object return either a valid Title object with namespace NS_FILE or null.
getTimestamp()
Get the 14-character timestamp of the file upload.
assertRepoDefined()
Assert that $this->repo is set to a valid FileRepo instance.
getName()
Return the name of this file.
resetHistory()
Reset the history pointer to the first element of the history.
canAnimateThumbIfAppropriate()
Will the thumbnail be animated if one would expect it to be.
getWidth( $page=1)
Return the width of the image.
getLocalRefPath()
Get an FS copy or original of this file and return the path.
exists()
Returns true if file exists in the repository.
getMatchedLanguage( $userPreferredLanguage)
Get the language code from the available languages for this file that matches the language requested ...
getThumbUrl( $suffix=false)
Get the URL of the thumbnail directory, or a particular file if $suffix is specified.
allowInlineDisplay()
Alias for canRender()
string false $pageCount
Number of pages of a multipage document, or false for documents which aren't multipage documents.
mustRender()
Return true if the file is of a type that can't be directly rendered by typical browsers and needs to...
getVirtualUrl( $suffix=false)
Get the public zone virtual URL for a current version source file.
isTrustedFile()
Returns true if the file is flagged as trusted.
getHistory( $limit=null, $start=null, $end=null, $inc=true)
Return a fragment of the history of file.
isCacheable()
Check if this file object is small and can be cached.
isVisible()
Returns true if file exists in the repository and can be included in a page.
iconThumb()
Get a ThumbnailImage representing a file type icon.
getRepo()
Returns the repository.
getZoneUrl( $zone, $suffix=false)
Get the URL of the zone directory, or a particular file if $suffix is specified.
upgradeRow()
Upgrade the database row if there is one Called by ImagePage STUB.
convertMetadataVersion( $metadata, $version)
get versioned metadata
getCanRender()
Accessor for __get()
getDescriptionText(Language $lang=null)
Get the HTML text of the description page, if available.
getArchiveVirtualUrl( $suffix=false)
Get the public zone virtual URL for an archived version source file.
assertTitleDefined()
Assert that $this->title is set to a Title.
getArchiveThumbPath( $archiveName, $suffix=false)
Get the path of an archived file's thumbs, or a particular thumb if $suffix is specified.
getHeight( $page=1)
Return the height of the image.
getThumbnailSource( $params)
Returns the most appropriate source image for the thumbnail, given a target thumbnail size.
getArchiveThumbRel( $archiveName, $suffix=false)
Get the path, relative to the thumbnail zone root, for an archived file's thumbs directory or a speci...
getUser( $type='text')
Returns ID or name of user who uploaded the file STUB.
makeTransformTmpFile( $thumbPath)
Creates a temp FS file with the same extension and the thumbnail.
getBitDepth()
Return the bit depth of the file Overridden by LocalFile STUB.
publish( $src, $flags=0, array $options=[])
Move or copy a file to its public location.
isOld()
Returns true if the image is an old version STUB.
getTitle()
Return the associated title object.
getDescriptionShortUrl()
Get short description URL for a files based on the page ID.
canRender()
Checks if the output of transform() for this file is likely to be valid.
getAvailableLanguages()
Gives a (possibly empty) list of languages to render the file in.
getCommonMetaArray()
Like getMetadata but returns a handler independent array of common values.
getOriginalTitle()
Return the title used to find this file.
getRepoName()
Returns the name of the repository.
getDefaultRenderLanguage()
In files that support multiple language, what is the default language to use if none specified.
migrateThumbFile( $thumbName)
Hook into transform() to allow migration of thumbnail files STUB Overridden by LocalFile.
static compare(File $a, File $b)
Callback for usort() to do file sorts by name.
isMultipage()
Returns 'true' if this file is a type which supports multiple pages, e.g.
isSafeFile()
Determines if this media file is in a format that is unlikely to contain viruses or malicious content...
getThumbnails()
Get all thumbnail names previously generated for this file STUB Overridden by LocalFile.
createThumb( $width, $height=-1)
Create a thumbnail of the image having the specified width/height.
string $name
The name of a file from its title object.
getTranscodedPath( $suffix=false)
Get the path of the transcoded directory, or a particular file if $suffix is specified.
load( $flags=0)
Load any lazy-loaded file object fields from source.
getExtension()
Get the file extension, e.g.
FileRepo LocalRepo ForeignAPIRepo bool $repo
Some member variables can be lazy-initialised using __get().
transform( $params, $flags=0)
Transform a media file.
getImageSize( $filePath)
Get an image size array like that returned by getImageSize(), or false if it can't be determined.
nextHistoryLine()
Return the history of this file, line by line.
purgeEverything()
Purge metadata and all affected pages when the file is created, deleted, or majorly updated.
string $path
The storage path corresponding to one of the zones.
static normalizeExtension( $extension)
Normalize a file extension to the common form, making it lowercase and checking some synonyms,...
static splitMime( $mime)
Split an internet media type into its two components; if not a two-part name, set the minor type to '...
getUrl()
Return the URL of the file.
wasDeleted()
Was this file ever deleted from the wiki?
string $transformScript
URL of transformscript (for example thumb.php)
string $repoClass
Required Repository class type.
thumbName( $params, $flags=0)
Return the file name of a thumbnail with the specified parameters.
getArchiveUrl( $suffix=false)
Get the URL of the archive directory, or a particular file if $suffix is specified.
getSha1()
Get the SHA-1 base 36 hash of the file.
formatMetadata( $context=false)
userCan( $field, User $user=null)
Determine if the current user is allowed to view a particular field of this file, if it's marked as d...
isTransformedLocally()
Whether the thumbnails created on the same server as this code is running.
getHandler()
Get a MediaHandler instance for this file.
getDescriptionUrl()
Get the URL of the image description page.
string $hashPath
Relative path including trailing slash.
getBucketThumbPath( $bucket)
Returns the repo path of the thumb for a given bucket.
purgeCache( $options=[])
Purge shared caches such as thumbnails and DB data caching STUB Overridden by LocalFile.
getThumbnailBucket( $desiredWidth, $page=1)
Return the smallest bucket from $wgThumbnailBuckets which is at least $wgThumbnailMinimumBucketDistan...
getUnscaledThumb( $handlerParams=[])
Get a ThumbnailImage which is the same size as the source.
getArchiveRel( $suffix=false)
Get the path of an archived file relative to the public zone root.
getUrlRel()
Get urlencoded path of the file relative to the public zone root.
getThumbDisposition( $thumbName, $dispositionType='inline')
move( $target)
Move file to the new title.
generateBucketsIfNeeded( $params, $flags=0)
Generates chained bucketed thumbnails if needed.
static scaleHeight( $srcWidth, $srcHeight, $dstWidth)
Calculate the height of a thumbnail using the source and destination width.
isDeleted( $field)
Is this file a "deleted" file in a private archive? STUB.
getArchiveThumbUrl( $archiveName, $suffix=false)
Get the URL of the archived file's thumbs, or a particular thumb if $suffix is specified.
getDescription( $audience=self::FOR_PUBLIC, User $user=null)
Get description of file revision STUB.
getMetadata()
Get handler-specific metadata Overridden by LocalFile, UnregisteredLocalFile STUB.
generateThumbName( $name, $params)
Generate a thumbnail file name from a name and specified parameters.
bool $canRender
Whether the output of transform() for this file is likely to be valid.
getFullUrl()
Return a fully-qualified URL to the file.
const RENDER_FORCE
Force rendering even if thumbnail already exist and using RENDER_NOW I.e.
static checkExtensionCompatibility(File $old, $new)
Checks if file extensions are compatible.
getHashPath()
Get the filename hash component of the directory including trailing slash, e.g.
string $lastError
Text of last error.
A foreign repository with a remote MediaWiki with an API thingy.
static newForBacklinks(Title $title, $table, $params=[])
Internationalisation code.
A repository that stores files in the local filesystem and registers them in the wiki's own database.
Convenience class for dealing with PoolCounters using callbacks.
execute( $skipcache=false)
Get the result of the work (whatever it is), or the result of the error() function.
Media transform output for images.
Represents a title within MediaWiki.
purgeSquid()
Purge all applicable CDN URLs.
isDeletedQuick()
Is there a version of this page in the deletion archive?
invalidateCache( $purgeTime=null)
Updates page_touched for this page; called from LinksUpdate.php.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Interface for database access objects.
if(count( $args)< 1) $job
if(!is_readable( $file)) $ext
if(!isset( $args[0])) $lang