Go to the documentation of this file.
8 use Wikimedia\AtEase\AtEase;
196 if ( $ret instanceof
Title ) {
197 # Normalize NS_MEDIA -> NS_FILE
198 if ( $ret->getNamespace() ==
NS_MEDIA ) {
200 # Sanity check the title namespace
201 } elseif ( $ret->getNamespace() !==
NS_FILE ) {
205 # Convert strings to Title objects
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,
'.' );
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 );
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' ]
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 ) {
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" );
getExtension()
Get the file extension, e.g.
wasDeleted()
Was this file ever deleted from the wiki?
getDescriptionTouched()
Returns the timestamp (in TS_MW format) of the last change of the description page.
getPath()
Return the storage path to the file.
Media transform output for images.
static checkExtensionCompatibility(File $old, $new)
Checks if file extensions are compatible.
FileRepo LocalRepo ForeignAPIRepo bool $repo
Some member variables can be lazy-initialised using __get().
canAnimateThumbIfAppropriate()
Will the thumbnail be animated if one would expect it to be.
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.
array $tmpBucketedThumbCache
Cache of tmp filepaths pointing to generated bucket thumbnails, keyed by width.
getDescriptionShortUrl()
Get short description URL for a files based on the page ID.
getBitDepth()
Return the bit depth of the file Overridden by LocalFile STUB.
getUrlRel()
Get urlencoded path of the file relative to the public zone root.
migrateThumbFile( $thumbName)
Hook into transform() to allow migration of thumbnail files STUB Overridden by LocalFile.
isMultipage()
Returns 'true' if this file is a type which supports multiple pages, e.g.
getFullUrl()
Return a fully-qualified URL to the file.
getZoneUrl( $zone, $suffix=false)
Get the URL of the zone directory, or a particular file if $suffix is specified.
getMetadata()
Get handler-specific metadata Overridden by LocalFile, UnregisteredLocalFile STUB.
if(!isset( $args[0])) $lang
getIsSafeFileUncached()
Uncached accessor.
string $transformScript
URL of transformscript (for example thumb.php)
getRel()
Get the path of the file relative to the public zone root.
isExpensiveToThumbnail()
True if creating thumbnails from the file is large or otherwise resource-intensive.
getOriginalTitle()
Return the title used to find this file.
getLastError()
Get last thumbnailing error.
getTimestamp()
Get the 14-character timestamp of the file upload.
getSha1()
Get the SHA-1 base 36 hash of the file.
convertMetadataVersion( $metadata, $version)
get versioned metadata
getUser( $type='text')
Returns ID or name of user who uploaded the file STUB.
static extensionFromPath( $path, $case='lowercase')
Get the final extension from a storage or FS path.
const RENDER_FORCE
Force rendering even if thumbnail already exist and using RENDER_NOW I.e.
getUrl()
Return the URL of the file.
static compare(File $a, File $b)
Callback for usort() to do file sorts by name.
getTranscodedUrl( $suffix=false)
Get the URL of the transcoded directory, or a particular file if $suffix is specified.
getThumbnailSource( $params)
Returns the most appropriate source image for the thumbnail, given a target thumbnail size.
getWidth( $page=1)
Return the width of the image.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
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.
getMediaType()
Return the type of the media in the file.
restore( $versions=[], $unsuppress=false)
Restore all or specified deleted revisions to the given file.
static splitMime( $mime)
Split an internet media type into its two components; if not a two-part name, set the minor type to '...
isVisible()
Returns true if file exists in the repository and can be included in a page.
Convenience class for dealing with PoolCounters using callbacks.
$wgThumbnailBuckets
When defined, is an array of image widths used as buckets for thumbnail generation.
Interface for database access objects.
string $repoClass
Required Repository class type.
getArchiveRel( $suffix=false)
Get the path of an archived file relative to the public zone root.
isDeleted( $field)
Is this file a "deleted" file in a private archive? STUB.
getVisibility()
Return the deletion bitfield STUB.
static newForBacklinks(Title $title, $table, $params=[])
$wgThumbnailMinimumBucketDistance
When using thumbnail buckets as defined above, this sets the minimum distance to the bucket above the...
static normalizeTitle( $title, $exception=false)
Given a string or Title object return either a valid Title object with namespace NS_FILE or null.
exists()
Returns true if file exists in the repository.
getThumbVirtualUrl( $suffix=false)
Get the virtual URL for a thumbnail file or directory.
$wgThumbnailEpoch
If rendered thumbnail files are older than this timestamp, they will be rerendered on demand as if th...
upgradeRow()
Upgrade the database row if there is one Called by ImagePage STUB.
Base class for file repositories.
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
string $path
The storage path corresponding to one of the zones.
isCacheable()
Check if this file object is small and can be cached.
bool $canRender
Whether the output of transform() for this file is likely to be valid.
getBucketThumbName( $bucket)
Returns the name of the thumb for a given bucket.
Implements some public methods and some protected utility functions which are required by multiple ch...
getMimeType()
Returns the MIME type of the file.
getDefaultRenderLanguage()
In files that support multiple language, what is the default language to use if none specified.
string $url
The URL corresponding to one of the four basic zones.
getLocalRefPath()
Get an FS copy or original of this file and return the path.
transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags)
Return either a MediaTransformError or placeholder thumbnail (if $wgIgnoreImageErrors)
getIsSafeFile()
Accessor for __get()
getThumbPath( $suffix=false)
Get the path of the thumbnail directory, or a particular file if $suffix is specified.
pageCount()
Returns the number of pages of a multipage document, or false for documents which aren't multipage do...
nextHistoryLine()
Return the history of this file, line by line.
static normalizeExtension( $extension)
Normalize a file extension to the common form, making it lowercase and checking some synonyms,...
execute( $skipcache=false)
Get the result of the work (whatever it is), or the result of the error() function.
getArchiveVirtualUrl( $suffix=false)
Get the public zone virtual URL for an archived version source file.
purgeCache( $options=[])
Purge shared caches such as thumbnails and DB data caching STUB Overridden by LocalFile.
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
getArchiveThumbRel( $archiveName, $suffix=false)
Get the path, relative to the thumbnail zone root, for an archived file's thumbs directory or a speci...
getStorageKey()
Get the deletion archive key, "<sha1>.<ext>".
__construct( $title, $repo)
Call this constructor from child classes.
generateAndSaveThumb( $tmpFile, $transformParams, $flags)
Generates a thumbnail according to the given parameters and saves it to storage.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
getCommonMetaArray()
Like getMetadata but returns a handler independent array of common values.
getThumbRel( $suffix=false)
Get the path, relative to the thumbnail zone root, of the thumbnail directory or a particular file if...
isTransformedLocally()
Whether the thumbnails created on the same server as this code is running.
canRender()
Checks if the output of transform() for this file is likely to be valid.
FSFile bool $fsFile
False if undefined.
string false $pageCount
Number of pages of a multipage document, or false for documents which aren't multipage documents.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
getAvailableLanguages()
Gives a (possibly empty) list of languages to render the file in.
iconThumb()
Get a ThumbnailImage representing a file type icon.
purgeDescription()
Purge the file description page, but don't go after pages using the file.
isOld()
Returns true if the image is an old version STUB.
assertTitleDefined()
Assert that $this->title is set to a Title.
$wgIgnoreImageErrors
If set, inline scaled images will still produce "<img>" tags ready for output instead of showing an e...
getHistory( $limit=null, $start=null, $end=null, $inc=true)
Return a fragment of the history of file.
generateThumbName( $name, $params)
Generate a thumbnail file name from a name and specified parameters.
formatMetadata( $context=false)
createThumb( $width, $height=-1)
Create a thumbnail of the image having the specified width/height.
getDescriptionUrl()
Get the URL of the image description page.
getArchiveThumbUrl( $archiveName, $suffix=false)
Get the URL of the archived file's thumbs, or a particular thumb if $suffix is specified.
getName()
Return the name of this file.
getArchiveUrl( $suffix=false)
Get the URL of the archive directory, or a particular file if $suffix is specified.
getThumbDisposition( $thumbName, $dispositionType='inline')
Class representing a non-directory file on the file system.
isSafeFile()
Determines if this media file is in a format that is unlikely to contain viruses or malicious content...
getRepoName()
Returns the name of the repository.
$wgResourceBasePath
The default 'remoteBasePath' value for instances of ResourceLoaderFileModule.
publish( $src, $flags=0, array $options=[])
Move or copy a file to its public location.
string $extension
File extension.
getBucketThumbPath( $bucket)
Returns the repo path of the thumb for a given bucket.
string $hashPath
Relative path including trailing slash.
static scaleHeight( $srcWidth, $srcHeight, $dstWidth)
Calculate the height of a thumbnail using the source and destination width.
const RENDER_NOW
Force rendering in the current process.
transform( $params, $flags=0)
Transform a media file.
unserialize( $serialized)
getTitle()
Return the associated title object.
Represents a title within MediaWiki.
A foreign repository with a remote MediaWiki with an API thingy.
bool $isSafeFile
Whether this media file is in a format that is unlikely to contain viruses or malicious content.
static singleton( $domain=false)
getThumbnailBucket( $desiredWidth, $page=1)
Return the smallest bucket from $wgThumbnailBuckets which is at least $wgThumbnailMinimumBucketDistan...
move( $target)
Move file to the new title.
assertRepoDefined()
Assert that $this->repo is set to a valid FileRepo instance.
if(count( $args)< 1) $job
getDescription( $audience=self::FOR_PUBLIC, User $user=null)
Get description of file revision STUB.
getLength()
Get the duration of a media file in seconds.
isLocal()
Returns true if the file comes from the local file repository.
purgeSquid()
Purge all applicable CDN URLs.
getDescriptionText(Language $lang=null)
Get the HTML text of the description page, if available.
getCanRender()
Accessor for __get()
mustRender()
Return true if the file is of a type that can't be directly rendered by typical browsers and needs to...
load( $flags=0)
Load any lazy-loaded file object fields from source.
isDeletedQuick()
Is there a version of this page in the deletion archive?
resetHistory()
Reset the history pointer to the first element of the history.
if(!is_readable( $file)) $ext
string $name
The name of a file from its title object.
getMatchedLanguage( $userPreferredLanguage)
Get the language code from the available languages for this file that matches the language requested ...
getRepo()
Returns the repository.
allowInlineDisplay()
Alias for canRender()
invalidateCache( $purgeTime=null)
Updates page_touched for this page; called from LinksUpdate.php.
getThumbUrl( $suffix=false)
Get the URL of the thumbnail directory, or a particular file if $suffix is specified.
isVectorized()
Return true if the file is vectorized.
getHandler()
Get a MediaHandler instance for this file.
$wgTrustedMediaFormats
list of trusted media-types and MIME types.
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...
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
generateBucketsIfNeeded( $params, $flags=0)
Generates chained bucketed thumbnails if needed.
thumbName( $params, $flags=0)
Return the file name of a thumbnail with the specified parameters.
string $lastError
Text of last error.
string $redirected
Main part of the title, with underscores (Title::getDBkey)
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
getImageSize( $filePath)
Get an image size array like that returned by getImageSize(), or false if it can't be determined.
getPath()
Returns the file system path.
makeTransformTmpFile( $thumbPath)
Creates a temp FS file with the same extension and the thumbnail.
getArchivePath( $suffix=false)
Get the path of the archived file.
Internationalisation code.
purgeEverything()
Purge metadata and all affected pages when the file is created, deleted, or majorly updated.
getUnscaledThumb( $handlerParams=[])
Get a ThumbnailImage which is the same size as the source.
getHashPath()
Get the filename hash component of the directory including trailing slash, e.g.
isTrustedFile()
Returns true if the file is flagged as trusted.
A repository that stores files in the local filesystem and registers them in the wiki's own database.
getSize()
Return the size of the image file, in bytes Overridden by LocalFile, UnregisteredLocalFile STUB.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
getThumbnails()
Get all thumbnail names previously generated for this file STUB Overridden by LocalFile.
getTranscodedPath( $suffix=false)
Get the path of the transcoded directory, or a particular file if $suffix is specified.
getVirtualUrl( $suffix=false)
Get the public zone virtual URL for a current version source file.
static makeContentDisposition( $type, $filename='')
Build a Content-Disposition header value per RFC 6266.