Go to the documentation of this file.
8 use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
10 use Wikimedia\AtEase\AtEase;
64 use ProtectedHookAccessorTrait;
201 if ( $ret instanceof
Title ) {
202 # Normalize NS_MEDIA -> NS_FILE
203 if ( $ret->getNamespace() ===
NS_MEDIA ) {
205 # Sanity check the title namespace
206 } elseif ( $ret->getNamespace() !==
NS_FILE ) {
210 # Convert strings to Title objects
213 if ( !$ret && $exception !==
false ) {
214 throw new MWException(
"`$title` is not a valid file title." );
221 $function = [ $this,
'get' . ucfirst(
$name ) ];
222 if ( !is_callable( $function ) ) {
225 $this->
$name = $function();
247 if ( isset( $squish[$lower] ) ) {
248 return $squish[$lower];
249 } elseif ( preg_match(
'/^[0-9a-z]+$/', $lower ) ) {
266 $n = strrpos( $new,
'.' );
270 return $mimeMagic->isMatchingExtension( $newExt, $oldMime );
291 if ( strpos(
$mime,
'/' ) !==
false ) {
292 return explode(
'/',
$mime, 2 );
294 return [
$mime,
'unknown' ];
316 if ( $this->name ===
null ) {
318 $this->name = $this->repo->getNameFromTitle( $this->title );
331 if ( !isset( $this->extension ) ) {
332 $n = strrpos( $this->
getName(),
'.' );
334 $n ? substr( $this->
getName(), $n + 1 ) :
'' );
355 if ( $this->redirected ) {
369 if ( !isset( $this->url ) ) {
372 $this->url = $this->repo->getZoneUrl(
'public',
$ext ) .
'/' . $this->
getUrlRel();
417 wfDebug( __METHOD__ .
': supposed to render ' . $this->
getName() .
420 return $this->
getUrl(); # hm...
return NULL?
442 if ( !isset( $this->path ) ) {
444 $this->path = $this->repo->getZonePath(
'public' ) .
'/' . $this->
getRel();
459 if ( !isset( $this->fsFile ) ) {
460 $starttime = microtime(
true );
461 $this->fsFile = $this->repo->getLocalReference( $this->
getPath() );
463 $statTiming = microtime(
true ) - $starttime;
464 MediaWikiServices::getInstance()->getStatsdDataFactory()->timing(
465 'media.thumbnail.generate.fetchoriginal', 1000 * $statTiming );
467 if ( !$this->fsFile ) {
468 $this->fsFile =
false;
472 return ( $this->fsFile )
473 ? $this->fsFile->getPath()
519 $imageWidth = $this->
getWidth( $page );
521 if ( $imageWidth ===
false ) {
525 if ( $desiredWidth > $imageWidth ) {
535 sort( $sortedBuckets );
537 foreach ( $sortedBuckets as $bucket ) {
538 if ( $bucket >= $imageWidth ) {
562 if ( !$maxWidth || !$maxHeight ) {
564 throw new MWException(
'Using a choice from $wgImageLimits that is 0x0' );
569 if ( !$width || !$height ) {
574 if ( $width <= $maxWidth && $height <= $maxHeight ) {
576 } elseif ( $width / $height >= $maxWidth / $maxHeight ) {
577 # The limiting factor is the width, not the height.
578 $height = round( $height * $maxWidth / $width );
582 $newwidth = floor( $width * $maxHeight / $height );
583 $height = round( $height * $newwidth / $width );
588 return [ $width, $height ];
663 $userPreferredLanguage,
752 if ( !is_array( $metadata ) ) {
794 return 'unknown/unknown';
849 return $this->
getHandler() && $this->handler->mustRender( $this );
910 return false; # unknown type, not trusted
916 if (
$mime ===
"unknown/unknown" ) {
917 return false; # unknown type, not trusted
940 # this could be implemented to check a flag in the database,
941 # look for signatures, etc
955 public function load( $flags = 0 ) {
967 return $this->
getPath() && $this->repo->fileExists( $this->path );
985 if ( !isset( $this->transformScript ) ) {
986 $this->transformScript =
false;
988 $script = $this->repo->getThumbScriptUrl();
1006 $hp =& $handlerParams;
1007 $page = $hp[
'page'] ??
false;
1012 $hp[
'width'] = $width;
1014 unset( $hp[
'height'] );
1031 ? $this->repo->nameForThumb( $this->
getName() )
1050 list( $thumbExt, ) = $this->
getHandler()->getThumbType(
1052 $thumbName = $this->
getHandler()->makeParamString( $params );
1054 if ( $this->repo->supportsSha1URLs() ) {
1055 $thumbName .=
'-' . $this->
getSha1() .
'.' . $thumbExt;
1057 $thumbName .=
'-' .
$name;
1060 $thumbName .=
".$thumbExt";
1085 $params = [
'width' => $width ];
1086 if ( $height != -1 ) {
1087 $params[
'height'] = $height;
1090 if ( !$thumb || $thumb->isError() ) {
1094 return $thumb->getUrl();
1110 if (
$handler && $wgIgnoreImageErrors && !( $flags & self::RENDER_NOW ) ) {
1114 $params[
'width'], 0,
wfMessage(
'thumbnail-dest-create' ) );
1138 if ( $descriptionUrl ) {
1144 if ( $script && !( $flags & self::RENDER_NOW ) ) {
1152 $normalisedParams = $params;
1155 $thumbName = $this->
thumbName( $normalisedParams );
1159 if ( $this->repo ) {
1161 if ( $this->repo->canTransformVia404() && !( $flags & self::RENDER_NOW ) ) {
1169 wfDebug( __METHOD__ .
": Doing stat for $thumbPath" );
1170 if ( !( $flags & self::RENDER_FORCE ) && $this->repo->fileExists( $thumbPath ) ) {
1171 $timestamp = $this->repo->getFileTimestamp( $thumbPath );
1177 $thumb->setStoragePath( $thumbPath );
1180 } elseif ( $flags & self::RENDER_FORCE ) {
1181 wfDebug( __METHOD__ .
" forcing rendering per flag File::RENDER_FORCE" );
1186 if ( $this->repo->getReadOnlyReason() !==
false ) {
1201 return is_object( $thumb ) ? $thumb :
false;
1214 $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
1218 $normalisedParams = $transformParams;
1221 $thumbName = $this->
thumbName( $normalisedParams );
1225 $tmpThumbPath = $tmpFile->getPath();
1231 $starttime = microtime(
true );
1235 $tmpFile->bind( $thumb );
1237 $statTiming = microtime(
true ) - $starttime;
1238 $stats->timing(
'media.thumbnail.generate.transform', 1000 * $statTiming );
1242 } elseif ( $thumb->isError() ) {
1244 '@phan-var MediaTransformError $thumb';
1245 $this->lastError = $thumb->toText();
1250 } elseif ( $this->repo && $thumb->hasFile() && !$thumb->fileIsSource() ) {
1253 $starttime = microtime(
true );
1256 $status = $this->repo->quickImport( $tmpThumbPath, $thumbPath, $disposition );
1257 if ( $status->isOK() ) {
1258 $thumb->setStoragePath( $thumbPath );
1263 $statTiming = microtime(
true ) - $starttime;
1264 $stats->timing(
'media.thumbnail.generate.store', 1000 * $statTiming );
1267 $this->getHookRunner()->onFileTransformed( $this, $thumb, $tmpThumbPath, $thumbPath );
1281 || !isset( $params[
'physicalWidth'] )
1282 || !isset( $params[
'physicalHeight'] )
1289 if ( !$bucket || $bucket == $params[
'physicalWidth'] ) {
1295 if ( $this->repo->fileExists( $bucketPath ) ) {
1299 $starttime = microtime(
true );
1301 $params[
'physicalWidth'] = $bucket;
1302 $params[
'width'] = $bucket;
1304 $params = $this->
getHandler()->sanitizeParamsForBucketing( $params );
1314 $buckettime = microtime(
true ) - $starttime;
1316 if ( !$thumb || $thumb->isError() ) {
1320 $this->tmpBucketedThumbCache[$bucket] = $tmpFile->getPath();
1323 $tmpFile->bind( $this );
1325 MediaWikiServices::getInstance()->getStatsdDataFactory()->timing(
1326 'media.thumbnail.generate.bucket', 1000 * $buckettime );
1339 && isset( $params[
'physicalWidth'] )
1349 if ( isset( $this->tmpBucketedThumbCache[$bucket] ) ) {
1350 $tmpPath = $this->tmpBucketedThumbCache[$bucket];
1352 if ( file_exists( $tmpPath ) ) {
1356 'height' => $bucketHeight
1363 if ( $this->repo->fileExists( $bucketPath ) ) {
1364 $fsFile = $this->repo->getLocalReference( $bucketPath );
1370 'height' => $bucketHeight
1378 if ( $this->
getSize() >= 1e7 ) {
1381 'doWork' =>
function () {
1415 return $this->
thumbName( [
'physicalWidth' => $bucket ] );
1425 return MediaWikiServices::getInstance()->getTempFSFileFactory()
1426 ->newTempFSFile(
'transform_', $thumbExt );
1437 if ( $thumbExt !=
'' && $thumbExt !== $this->
getExtension() ) {
1438 $fileName .=
".$thumbExt";
1460 if ( !isset( $this->handler ) ) {
1474 $assetsPath =
"$wgResourceBasePath/resources/assets/file-type-icons/";
1475 $assetsDirectory =
"$IP/resources/assets/file-type-icons/";
1477 $try = [
'fileicon-' . $this->
getExtension() .
'.png',
'fileicon.png' ];
1478 foreach ( $try as $icon ) {
1479 if ( file_exists( $assetsDirectory . $icon ) ) {
1480 $params = [
'width' => 120,
'height' => 120 ];
1482 return new ThumbnailImage( $this, $assetsPath . $icon,
false, $params );
1529 $hcu = MediaWikiServices::getInstance()->getHtmlCacheUpdater();
1530 $hcu->purgeTitleUrls(
$title, $hcu::PURGE_INTENT_TXROUND_REFLECTED );
1548 [
'causeAction' =>
'file-purge' ]
1566 public function getHistory( $limit =
null, $start =
null, $end =
null, $inc =
true ) {
1602 if ( $this->hashPath ===
null ) {
1604 $this->hashPath = $this->repo->getHashPath( $this->
getName() );
1631 if ( $suffix ===
false ) {
1650 if ( $suffix !==
false ) {
1651 $path .=
'/' . $suffix;
1678 if ( $suffix !==
false ) {
1679 $path .=
'/' . $suffix;
1694 return $this->repo->getZonePath(
'public' ) .
'/' . $this->
getArchiveRel( $suffix );
1707 return $this->repo->getZonePath(
'thumb' ) .
'/' .
1721 return $this->repo->getZonePath(
'thumb' ) .
'/' . $this->
getThumbRel( $suffix );
1733 return $this->repo->getZonePath(
'transcoded' ) .
'/' . $this->
getThumbRel( $suffix );
1747 if ( $suffix ===
false ) {
1750 $path .= rawurlencode( $suffix );
1767 $path = $this->repo->getZoneUrl(
'thumb',
$ext ) .
'/archive/' .
1768 $this->
getHashPath() . rawurlencode( $archiveName );
1769 if ( $suffix !==
false ) {
1770 $path .=
'/' . rawurlencode( $suffix );
1787 if ( $suffix !==
false ) {
1788 $path .=
'/' . rawurlencode( $suffix );
1802 return $this->
getZoneUrl(
'thumb', $suffix );
1812 return $this->
getZoneUrl(
'transcoded', $suffix );
1824 $path = $this->repo->getVirtualUrl() .
'/public/' . $this->
getUrlRel();
1825 if ( $suffix !==
false ) {
1826 $path .=
'/' . rawurlencode( $suffix );
1841 $path = $this->repo->getVirtualUrl() .
'/public/archive/' . $this->
getHashPath();
1842 if ( $suffix ===
false ) {
1845 $path .= rawurlencode( $suffix );
1860 $path = $this->repo->getVirtualUrl() .
'/thumb/' . $this->
getUrlRel();
1861 if ( $suffix !==
false ) {
1862 $path .=
'/' . rawurlencode( $suffix );
1874 return (
bool)$this->repo->getHashLevels();
1881 throw new MWException( static::class .
': write operations are not supported' );
1906 public function publish( $src, $flags = 0, array $options = [] ) {
1919 return $this->
getHandler()->formatMetadata( $this, $context );
1928 return $this->repo && $this->repo->isLocal();
1937 return $this->repo ? $this->repo->getName() :
'unknown';
2047 public function restore( $versions = [], $unsuppress =
false ) {
2060 return $this->
getHandler() && $this->handler->isMultiPage( $this );
2072 if ( $this->
getHandler() && $this->handler->isMultiPage( $this ) ) {
2073 $this->
pageCount = $this->handler->pageCount( $this );
2091 public static function scaleHeight( $srcWidth, $srcHeight, $dstWidth ) {
2093 if ( $srcWidth == 0 ) {
2096 return (
int)round( $srcHeight * $dstWidth / $srcWidth );
2116 return $this->
getHandler()->getImageSize( $this, $filePath );
2127 if ( $this->repo ) {
2128 return $this->repo->getDescriptionUrl( $this->
getName() );
2145 if ( !$this->repo || !$this->repo->fetchDescription ) {
2151 $renderUrl = $this->repo->getDescriptionRenderUrl( $this->
getName(),
$lang->getCode() );
2153 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
2154 $key = $this->repo->getLocalCacheKey(
2155 'file-remote-description',
2159 $fname = __METHOD__;
2161 return $cache->getWithSetCallback(
2163 $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
2164 function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl, $fname ) {
2165 wfDebug(
"Fetching shared description from $renderUrl" );
2166 $res = MediaWikiServices::getInstance()->getHttpRequestFactory()->
2167 get( $renderUrl, [], $fname );
2169 $ttl = WANObjectCache::TTL_UNCACHEABLE;
2206 return $this->repo->getFileTimestamp( $this->
getPath() );
2230 return $this->repo->getFileSha1( $this->
getPath() );
2244 $dotExt =
$ext ===
'' ?
'' :
".$ext";
2246 return $hash . $dotExt;
2271 if ( is_string( $metadata ) ) {
2272 $metadata = AtEase::quietCall(
'unserialize', $metadata );
2275 if ( !is_array( $metadata ) ) {
2332 if ( $this->redirected ) {
2333 if ( !$this->redirectTitle ) {
2348 $this->redirected = $from;
2373 if ( !( $this->repo instanceof $this->repoClass ) ) {
2374 throw new MWException(
"A {$this->repoClass} object is not set for this File.\n" );
2383 if ( !( $this->title instanceof
Title ) ) {
2384 throw new MWException(
"A Title object is not set for this File.\n" );
getExtension()
Get the file extension, e.g.
getDisplayWidthHeight( $maxWidth, $maxHeight, $page=1)
Get the width and height to display image at.
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 Stable to override.
getBitDepth()
Return the bit depth of the file Overridden by LocalFile STUB Stable to override.
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 Stable to override.
userCan( $field, User $user)
Determine if the current user is allowed to view a particular field of this file, if it's marked as d...
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 Stable to override.
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.
isMissing()
Stable to override.
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 Stable to override.
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.
getMediaType()
Return the type of the media in the file.
restore( $versions=[], $unsuppress=false)
Restore all or specified deleted revisions to the given file.
getCanonicalUrl()
Stable to override.
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 Stable to override.
isDeleted( $field)
Is this file a "deleted" file in a private archive? STUB.
getVisibility()
Return the deletion bitfield STUB Stable to override.
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 Stable to override.
$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 Stable to override.
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 Stable to overr...
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 Stable to override.
deleteFile( $reason, User $user, $suppress=false)
Delete all versions of the file.
purgeCache( $options=[])
Purge shared caches such as thumbnails and DB data caching STUB Overridden by LocalFile Stable to ove...
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.
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.
hasDeletedEdits()
Is there a version of this page in the deletion archive?
generateThumbName( $name, $params)
Generate a thumbnail file name from a name and specified parameters Stable to override.
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 Stable to ov...
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 Stable to override...
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...
int false $pageCount
Number of pages of a multipage document, or false for documents which aren't multipage documents.
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 Stable to override.
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.
getDescriptionText(Language $lang=null)
Get the HTML text of the description page, if available Stable to override.
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.
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 Stable to override.
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 Stable to overri...
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.
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)
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 See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
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 Stabl...
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 Stable to ove...
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 Stable to override.
static makeContentDisposition( $type, $filename='')
Build a Content-Disposition header value per RFC 6266.