MediaWiki
1.28.0
|
Implements some public methods and some protected utility functions which are required by multiple child classes. More...
Public Member Functions | |
__construct ($title, $repo) | |
Call this constructor from child classes. More... | |
__get ($name) | |
allowInlineDisplay () | |
Alias for canRender() More... | |
canAnimateThumbIfAppropriate () | |
Will the thumbnail be animated if one would expect it to be. More... | |
canRender () | |
Checks if the output of transform() for this file is likely to be valid. More... | |
convertMetadataVersion ($metadata, $version) | |
get versioned metadata More... | |
createThumb ($width, $height=-1) | |
Create a thumbnail of the image having the specified width/height. More... | |
delete ($reason, $suppress=false, $user=null) | |
Delete all versions of the file. More... | |
exists () | |
Returns true if file exists in the repository. More... | |
formatMetadata ($context=false) | |
generateAndSaveThumb ($tmpFile, $transformParams, $flags) | |
Generates a thumbnail according to the given parameters and saves it to storage. More... | |
generateThumbName ($name, $params) | |
Generate a thumbnail file name from a name and specified parameters. More... | |
getArchivePath ($suffix=false) | |
Get the path of the archived file. More... | |
getArchiveRel ($suffix=false) | |
Get the path of an archived file relative to the public zone root. More... | |
getArchiveThumbPath ($archiveName, $suffix=false) | |
Get the path of an archived file's thumbs, or a particular thumb if $suffix is specified. More... | |
getArchiveThumbRel ($archiveName, $suffix=false) | |
Get the path, relative to the thumbnail zone root, for an archived file's thumbs directory or a specific thumb if the $suffix is given. More... | |
getArchiveThumbUrl ($archiveName, $suffix=false) | |
Get the URL of the archived file's thumbs, or a particular thumb if $suffix is specified. More... | |
getArchiveUrl ($suffix=false) | |
Get the URL of the archive directory, or a particular file if $suffix is specified. More... | |
getArchiveVirtualUrl ($suffix=false) | |
Get the public zone virtual URL for an archived version source file. More... | |
getAvailableLanguages () | |
Gives a (possibly empty) list of languages to render the file in. More... | |
getBitDepth () | |
Return the bit depth of the file Overridden by LocalFile STUB. More... | |
getCanonicalUrl () | |
getCommonMetaArray () | |
Like getMetadata but returns a handler independent array of common values. More... | |
getDefaultRenderLanguage () | |
In files that support multiple language, what is the default language to use if none specified. More... | |
getDescription ($audience=self::FOR_PUBLIC, User $user=null) | |
Get description of file revision STUB. More... | |
getDescriptionShortUrl () | |
getDescriptionText ($lang=false) | |
Get the HTML text of the description page, if available. More... | |
getDescriptionTouched () | |
Returns the timestamp (in TS_MW format) of the last change of the description page. More... | |
getDescriptionUrl () | |
Get the URL of the image description page. More... | |
getDimensionsString () | |
getExtension () | |
Get the file extension, e.g. More... | |
getFullUrl () | |
Return a fully-qualified URL to the file. More... | |
getHandler () | |
Get a MediaHandler instance for this file. More... | |
getHashPath () | |
Get the filename hash component of the directory including trailing slash, e.g. More... | |
getHeight ($page=1) | |
Return the height of the image. More... | |
getHistory ($limit=null, $start=null, $end=null, $inc=true) | |
Return a fragment of the history of file. More... | |
getImageSize ($filePath) | |
Get an image size array like that returned by getImageSize(), or false if it can't be determined. More... | |
getLastError () | |
Get last thumbnailing error. More... | |
getLength () | |
Get the duration of a media file in seconds. More... | |
getLocalRefPath () | |
Get an FS copy or original of this file and return the path. More... | |
getLongDesc () | |
getMediaType () | |
Return the type of the media in the file. More... | |
getMetadata () | |
Get handler-specific metadata Overridden by LocalFile, UnregisteredLocalFile STUB. More... | |
getMimeType () | |
Returns the MIME type of the file. More... | |
getName () | |
Return the name of this file. More... | |
getOriginalTitle () | |
Return the title used to find this file. More... | |
getPath () | |
Return the storage path to the file. More... | |
getRedirected () | |
getRedirectedTitle () | |
getRel () | |
Get the path of the file relative to the public zone root. More... | |
getRepo () | |
Returns the repository. More... | |
getRepoName () | |
Returns the name of the repository. More... | |
getSha1 () | |
Get the SHA-1 base 36 hash of the file. More... | |
getShortDesc () | |
getSize () | |
Return the size of the image file, in bytes Overridden by LocalFile, UnregisteredLocalFile STUB. More... | |
getStorageKey () | |
Get the deletion archive key, "<sha1>.<ext>". More... | |
getStreamHeaders () | |
getThumbDisposition ($thumbName, $dispositionType= 'inline') | |
getThumbnailBucket ($desiredWidth, $page=1) | |
Return the smallest bucket from $wgThumbnailBuckets which is at least $wgThumbnailMinimumBucketDistance larger than $desiredWidth. More... | |
getThumbnails () | |
Get all thumbnail names previously generated for this file STUB Overridden by LocalFile. More... | |
getThumbnailSource ($params) | |
Returns the most appropriate source image for the thumbnail, given a target thumbnail size. More... | |
getThumbPath ($suffix=false) | |
Get the path of the thumbnail directory, or a particular file if $suffix is specified. More... | |
getThumbRel ($suffix=false) | |
Get the path, relative to the thumbnail zone root, of the thumbnail directory or a particular file if $suffix is specified. More... | |
getThumbUrl ($suffix=false) | |
Get the URL of the thumbnail directory, or a particular file if $suffix is specified. More... | |
getThumbVirtualUrl ($suffix=false) | |
Get the virtual URL for a thumbnail file or directory. More... | |
getTimestamp () | |
Get the 14-character timestamp of the file upload. More... | |
getTitle () | |
Return the associated title object. More... | |
getTranscodedPath ($suffix=false) | |
Get the path of the transcoded directory, or a particular file if $suffix is specified. More... | |
getTranscodedUrl ($suffix=false) | |
Get the URL of the transcoded directory, or a particular file if $suffix is specified. More... | |
getTransformScript () | |
getUnscaledThumb ($handlerParams=[]) | |
Get a ThumbnailImage which is the same size as the source. More... | |
getUrl () | |
Return the URL of the file. More... | |
getUrlRel () | |
Get urlencoded path of the file relative to the public zone root. More... | |
getUser ($type= 'text') | |
Returns ID or name of user who uploaded the file STUB. More... | |
getViewURL () | |
getVirtualUrl ($suffix=false) | |
Get the public zone virtual URL for a current version source file. More... | |
getVisibility () | |
Return the deletion bitfield STUB. More... | |
getWidth ($page=1) | |
Return the width of the image. More... | |
getZoneUrl ($zone, $suffix=false) | |
Get the URL of the zone directory, or a particular file if $suffix is specified. More... | |
iconThumb () | |
Get a ThumbnailImage representing a file type icon. More... | |
isCacheable () | |
Check if this file object is small and can be cached. More... | |
isDeleted ($field) | |
Is this file a "deleted" file in a private archive? STUB. More... | |
isExpensiveToThumbnail () | |
True if creating thumbnails from the file is large or otherwise resource-intensive. More... | |
isHashed () | |
isLocal () | |
Returns true if the file comes from the local file repository. More... | |
isMissing () | |
isMultipage () | |
Returns 'true' if this file is a type which supports multiple pages, e.g. More... | |
isOld () | |
Returns true if the image is an old version STUB. More... | |
isSafeFile () | |
Determines if this media file is in a format that is unlikely to contain viruses or malicious content. More... | |
isTransformedLocally () | |
Whether the thumbnails created on the same server as this code is running. More... | |
isTrustedFile () | |
Returns true if the file is flagged as trusted. More... | |
isVectorized () | |
Return true if the file is vectorized. More... | |
isVisible () | |
Returns true if file exists in the repository and can be included in a page. More... | |
load ($flags=0) | |
Load any lazy-loaded file object fields from source. More... | |
migrateThumbFile ($thumbName) | |
Hook into transform() to allow migration of thumbnail files STUB Overridden by LocalFile. More... | |
move ($target) | |
Move file to the new title. More... | |
mustRender () | |
Return true if the file is of a type that can't be directly rendered by typical browsers and needs to be re-rasterized. More... | |
nextHistoryLine () | |
Return the history of this file, line by line. More... | |
pageCount () | |
Returns the number of pages of a multipage document, or false for documents which aren't multipage documents. More... | |
publish ($src, $flags=0, array $options=[]) | |
Move or copy a file to its public location. More... | |
purgeCache ($options=[]) | |
Purge shared caches such as thumbnails and DB data caching STUB Overridden by LocalFile. More... | |
purgeDescription () | |
Purge the file description page, but don't go after pages using the file. More... | |
purgeEverything () | |
Purge metadata and all affected pages when the file is created, deleted, or majorly updated. More... | |
readOnlyError () | |
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. More... | |
redirectedFrom ($from) | |
resetHistory () | |
Reset the history pointer to the first element of the history. More... | |
restore ($versions=[], $unsuppress=false) | |
Restore all or specified deleted revisions to the given file. More... | |
thumbName ($params, $flags=0) | |
Return the file name of a thumbnail with the specified parameters. More... | |
transform ($params, $flags=0) | |
Transform a media file. More... | |
upgradeRow () | |
Upgrade the database row if there is one Called by ImagePage STUB. More... | |
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 deleted. More... | |
wasDeleted () | |
Was this file ever deleted from the wiki? More... | |
Static Public Member Functions | |
static | checkExtensionCompatibility (File $old, $new) |
Checks if file extensions are compatible. More... | |
static | compare (File $a, File $b) |
Callback for usort() to do file sorts by name. More... | |
static | normalizeExtension ($extension) |
Normalize a file extension to the common form, making it lowercase and checking some synonyms, and ensure it's clean. More... | |
static | normalizeTitle ($title, $exception=false) |
Given a string or Title object return either a valid Title object with namespace NS_FILE or null. More... | |
static | scaleHeight ($srcWidth, $srcHeight, $dstWidth) |
Calculate the height of a thumbnail using the source and destination width. More... | |
static | splitMime ($mime) |
Split an internet media type into its two components; if not a two-part name, set the minor type to 'unknown'. More... | |
Public Attributes | |
FileRepo LocalRepo ForeignAPIRepo bool | $repo |
Some member variables can be lazy-initialised using __get(). More... | |
const | DELETE_SOURCE = 1 |
const | DELETED_COMMENT = 2 |
const | DELETED_FILE = 1 |
const | DELETED_RESTRICTED = 8 |
const | DELETED_USER = 4 |
const | FOR_PUBLIC = 1 |
const | FOR_THIS_USER = 2 |
const | RAW = 3 |
const | RENDER_FORCE = 2 |
Force rendering even if thumbnail already exist and using RENDER_NOW I.e. More... | |
const | RENDER_NOW = 1 |
Force rendering in the current process. More... | |
const | THUMB_FULL_NAME = 1 |
Public Attributes inherited from IDBAccessObject | |
const | READ_LOCKING = 3 |
Constants for object loading bitfield flags (higher => higher QoS) More... | |
const | READ_NONE = -1 |
Protected Member Functions | |
assertRepoDefined () | |
Assert that $this->repo is set to a valid FileRepo instance. More... | |
assertTitleDefined () | |
Assert that $this->title is set to a Title. More... | |
generateBucketsIfNeeded ($params, $flags=0) | |
Generates chained bucketed thumbnails if needed. More... | |
getBucketThumbName ($bucket) | |
Returns the name of the thumb for a given bucket. More... | |
getBucketThumbPath ($bucket) | |
Returns the repo path of the thumb for a given bucket. More... | |
getCanRender () | |
Accessor for __get() More... | |
getIsSafeFile () | |
Accessor for __get() More... | |
getIsSafeFileUncached () | |
Uncached accessor. More... | |
makeTransformTmpFile ($thumbPath) | |
Creates a temp FS file with the same extension and the thumbnail. More... | |
transformErrorOutput ($thumbPath, $thumbUrl, $params, $flags) | |
Return either a MediaTransformError or placeholder thumbnail (if $wgIgnoreImageErrors) More... | |
Protected Attributes | |
bool | $canRender |
Whether the output of transform() for this file is likely to be valid. More... | |
string | $extension |
File extension. More... | |
FSFile bool | $fsFile |
False if undefined. More... | |
MediaHandler | $handler |
string | $hashPath |
Relative path including trailing slash. More... | |
bool | $isSafeFile |
Whether this media file is in a format that is unlikely to contain viruses or malicious content. More... | |
string | $lastError |
Text of last error. More... | |
string | $name |
The name of a file from its title object. More... | |
string | $pageCount |
Number of pages of a multipage document, or false for documents which aren't multipage documents. More... | |
string | $path |
The storage path corresponding to one of the zones. More... | |
string | $redirected |
Main part of the title, with underscores (Title::getDBkey) More... | |
Title | $redirectedTitle |
Title | $redirectTitle |
string | $repoClass = 'FileRepo' |
Required Repository class type. More... | |
Title string bool | $title |
array | $tmpBucketedThumbCache = [] |
Cache of tmp filepaths pointing to generated bucket thumbnails, keyed by width. More... | |
string | $transformScript |
URL of transformscript (for example thumb.php) More... | |
string | $url |
The URL corresponding to one of the four basic zones. More... | |
Implements some public methods and some protected utility functions which are required by multiple child classes.
Contains stub functionality for unimplemented public methods.
Stub functions which should be overridden are marked with STUB. Some more concrete functions are also typically overridden by child classes.
Note that only the repo object knows what its file class is called. You should never name a file class explictly outside of the repo class. Instead use the repo's factory functions to generate file objects, for example:
RepoGroup::singleton()->getLocalRepo()->newFile( $title );
The convenience functions wfLocalFile() and wfFindFile() should be sufficient in most cases.
File::__construct | ( | $title, | |
$repo | |||
) |
Call this constructor from child classes.
Both $title and $repo are optional, though some functions may return false or throw exceptions if they are not set. Most subclasses will want to call assertRepoDefined() here.
File::allowInlineDisplay | ( | ) |
Alias for canRender()
Definition at line 768 of file File.php.
References canRender().
Referenced by canAnimateThumbIfAppropriate(), and getIsSafeFileUncached().
|
protected |
Assert that $this->repo is set to a valid FileRepo instance.
MWException |
Definition at line 2247 of file File.php.
Referenced by ForeignAPIFile\__construct(), UnregisteredLocalFile\__construct(), LocalFile\__construct(), getArchivePath(), getArchiveThumbPath(), getArchiveThumbUrl(), getArchiveUrl(), getArchiveVirtualUrl(), getHashPath(), getLocalRefPath(), getName(), getPath(), getSha1(), UnregisteredLocalFile\getSize(), getThumbPath(), getThumbVirtualUrl(), getTimestamp(), getTranscodedPath(), getUrl(), getVirtualUrl(), getZoneUrl(), and isHashed().
|
protected |
Assert that $this->title is set to a Title.
MWException |
Definition at line 2257 of file File.php.
References title.
Referenced by LocalFile\__construct().
File::canAnimateThumbIfAppropriate | ( | ) |
Will the thumbnail be animated if one would expect it to be.
Currently used to add a warning to the image description page
Definition at line 609 of file File.php.
References allowInlineDisplay(), MediaHandler\canAnimateThumbnail(), getHandler(), and MediaHandler\isAnimatedImage().
File::canRender | ( | ) |
Checks if the output of transform() for this file is likely to be valid.
If this is false, various user elements will display a placeholder instead.
Currently, this checks if the file is an image format that can be converted to a format supported by all browsers (namely GIF, PNG and JPEG), or if it is an SVG image and SVG conversion is enabled.
Definition at line 733 of file File.php.
References $canRender, exists(), getHandler(), and handler.
Referenced by allowInlineDisplay(), getCanRender(), getViewURL(), ForeignAPIFile\transform(), and transform().
|
static |
Checks if file extensions are compatible.
File | $old | Old file |
string | $new | New name |
Definition at line 248 of file File.php.
References $mimeMagic, getMimeType(), and MimeMagic\singleton().
Referenced by MovePage\isValidFileMove().
File::convertMetadataVersion | ( | $metadata, | |
$version | |||
) |
get versioned metadata
array | string | $metadata | Array or string of (serialized) metadata |
int | $version | Version number. |
Definition at line 666 of file File.php.
References MediaHandler\convertMetadataVersion(), getHandler(), and unserialize().
File::createThumb | ( | $width, | |
$height = -1 |
|||
) |
Create a thumbnail of the image having the specified width/height.
The thumbnail will not be created if the width is larger than the image's width. Let the browser do the scaling in this case. The thumbnail is stored on disk and is only computed if the thumbnail file does not exist OR if it is older than the image. Returns the URL.
Keeps aspect ratio of original image. If both width and height are specified, the generated image will be no bigger than width x height, and will also have correct aspect ratio.
int | $width | Maximum width of the generated thumbnail |
int | $height | Maximum height of the image (optional) |
Definition at line 991 of file File.php.
References $params, and transform().
Referenced by getViewURL().
File::delete | ( | $reason, | |
$suppress = false , |
|||
$user = null |
|||
) |
Delete all versions of the file.
Moves the files into an archive directory (or deletes them) and removes the database rows.
Cache purging is done; logging is caller's responsibility.
string | $reason | |
bool | $suppress | Hide content from sysops? |
User | null | $user |
Definition at line 1929 of file File.php.
References readOnlyError().
Referenced by FileDeleteForm\doDelete().
File::exists | ( | ) |
Returns true if file exists in the repository.
Overridden by LocalFile to avoid unnecessary stat calls.
Definition at line 876 of file File.php.
References getPath().
Referenced by canRender(), LocalRepo\findFiles(), FileDeleteForm\haveDeletableFile(), isVisible(), and OutputPage\setFileVersion().
File::formatMetadata | ( | $context = false | ) |
bool | IContextSource | $context | Context to use (optional) |
Definition at line 1822 of file File.php.
References $context, and getHandler().
File::generateAndSaveThumb | ( | $tmpFile, | |
$transformParams, | |||
$flags | |||
) |
Generates a thumbnail according to the given parameters and saves it to storage.
TempFSFile | $tmpFile | Temporary file where the rendered thumbnail will be saved |
array | $transformParams | |
int | $flags |
Definition at line 1117 of file File.php.
References $flags, $starttime, $status, $wgIgnoreImageErrors, MediaHandler\doTransform(), generateBucketsIfNeeded(), getHandler(), RequestContext\getMain(), getThumbDisposition(), getThumbPath(), getThumbUrl(), MediaHandler\getTransform(), global, MediaHandler\normaliseParams(), Hooks\run(), MediaHandler\supportsBucketing(), thumbName(), and transformErrorOutput().
Referenced by generateBucketsIfNeeded(), and transform().
|
protected |
Generates chained bucketed thumbnails if needed.
array | $params | |
int | $flags |
Definition at line 1184 of file File.php.
References $flags, $params, $starttime, generateAndSaveThumb(), getBucketThumbPath(), getHandler(), RequestContext\getMain(), getThumbnailBucket(), and makeTransformTmpFile().
Referenced by generateAndSaveThumb().
File::generateThumbName | ( | $name, | |
$params | |||
) |
Generate a thumbnail file name from a name and specified parameters.
string | $name | |
array | $params | Parameters which will be passed to MediaHandler::makeParamString |
Definition at line 952 of file File.php.
References $name, $params, getExtension(), getHandler(), getMimeType(), getSha1(), and list.
Referenced by UploadStashFile\thumbName(), and thumbName().
File::getArchivePath | ( | $suffix = false | ) |
Get the path of the archived file.
bool | string | $suffix | If not false, the name of an archived file. |
Definition at line 1584 of file File.php.
References assertRepoDefined(), and getArchiveRel().
File::getArchiveRel | ( | $suffix = false | ) |
Get the path of an archived file relative to the public zone root.
bool | string | $suffix | If not false, the name of an archived thumbnail file |
Definition at line 1522 of file File.php.
References $path, and getHashPath().
Referenced by getArchivePath().
File::getArchiveThumbPath | ( | $archiveName, | |
$suffix = false |
|||
) |
Get the path of an archived file's thumbs, or a particular thumb if $suffix is specified.
string | $archiveName | The timestamped name of an archived image |
bool | string | $suffix | If not false, the name of a thumbnail file |
Definition at line 1597 of file File.php.
References assertRepoDefined(), and getArchiveThumbRel().
Referenced by LocalFile\getThumbnails().
File::getArchiveThumbRel | ( | $archiveName, | |
$suffix = false |
|||
) |
Get the path, relative to the thumbnail zone root, for an archived file's thumbs directory or a specific thumb if the $suffix is given.
string | $archiveName | The timestamped name of an archived image |
bool | string | $suffix | If not false, the name of a thumbnail file |
Definition at line 1567 of file File.php.
References $path, and getHashPath().
Referenced by getArchiveThumbPath().
File::getArchiveThumbUrl | ( | $archiveName, | |
$suffix = false |
|||
) |
Get the URL of the archived file's thumbs, or a particular thumb if $suffix is specified.
string | $archiveName | The timestamped name of an archived image |
bool | string | $suffix | If not false, the name of a thumbnail file |
Definition at line 1654 of file File.php.
References $ext, $path, assertRepoDefined(), getExtension(), and getHashPath().
Referenced by LocalFile\purgeOldThumbnails().
File::getArchiveUrl | ( | $suffix = false | ) |
Get the URL of the archive directory, or a particular file if $suffix is specified.
bool | string | $suffix | If not false, the name of an archived file |
Definition at line 1634 of file File.php.
References $ext, $path, assertRepoDefined(), getExtension(), and getHashPath().
Referenced by LocalFile\delete(), and LocalFile\deleteOld().
File::getArchiveVirtualUrl | ( | $suffix = false | ) |
Get the public zone virtual URL for an archived version source file.
bool | string | $suffix | If not false, the name of a thumbnail file |
Definition at line 1728 of file File.php.
References $path, assertRepoDefined(), and getHashPath().
File::getAvailableLanguages | ( | ) |
Gives a (possibly empty) list of languages to render the file in.
If the file doesn't have translations, or if the file format does not support that sort of thing, returns an empty array.
Definition at line 574 of file File.php.
References MediaHandler\getAvailableLanguages(), and getHandler().
File::getBitDepth | ( | ) |
|
protected |
Returns the name of the thumb for a given bucket.
int | $bucket |
Definition at line 1320 of file File.php.
References thumbName().
Referenced by getBucketThumbPath().
|
protected |
Returns the repo path of the thumb for a given bucket.
int | $bucket |
Definition at line 1310 of file File.php.
References getBucketThumbName(), and getThumbPath().
Referenced by generateBucketsIfNeeded(), and getThumbnailSource().
File::getCanonicalUrl | ( | ) |
Definition at line 381 of file File.php.
References getUrl(), PROTO_CANONICAL, and wfExpandUrl().
|
protected |
File::getCommonMetaArray | ( | ) |
Like getMetadata but returns a handler independent array of common values.
Definition at line 648 of file File.php.
References MediaHandler\getCommonMetaArray(), and getHandler().
File::getDefaultRenderLanguage | ( | ) |
In files that support multiple language, what is the default language to use if none specified.
Definition at line 590 of file File.php.
References MediaHandler\getDefaultRenderLanguage(), and getHandler().
File::getDescription | ( | $audience = self::FOR_PUBLIC , |
|
User | $user = null |
||
) |
Get description of file revision STUB.
int | $audience | One of: File::FOR_PUBLIC to be displayed to all users File::FOR_THIS_USER to be displayed to the given user File::RAW get the description regardless of permissions |
User | $user | User object to check for, only if FOR_THIS_USER is passed to the $audience parameter |
File::getDescriptionText | ( | $lang = false | ) |
Get the HTML text of the description page, if available.
bool | Language | $lang | Optional language to fetch description in |
Definition at line 2036 of file File.php.
References $cache, $lang, $res, $wgLang, array(), function, Http\get(), ObjectCache\getMainWANInstance(), getName(), global, WANObjectCache\TTL_UNCACHEABLE, use, and wfDebug().
File::getDescriptionTouched | ( | ) |
File::getDescriptionUrl | ( | ) |
Get the URL of the image description page.
May return false if it is unknown or not applicable.
Definition at line 2022 of file File.php.
References getName().
Referenced by ForeignDBFile\getDescriptionUrl(), and transform().
File::getDimensionsString | ( | ) |
Definition at line 2189 of file File.php.
References MediaHandler\getDimensionsString(), and getHandler().
File::getExtension | ( | ) |
Get the file extension, e.g.
"svg"
Definition at line 310 of file File.php.
References $extension, and getName().
Referenced by generateThumbName(), getArchiveThumbUrl(), getArchiveUrl(), ForeignAPIFile\getMimeType(), getStorageKey(), getThumbDisposition(), getUrl(), getZoneUrl(), and iconThumb().
File::getFullUrl | ( | ) |
Return a fully-qualified URL to the file.
Upload URL paths may or may not be fully qualified, so we check. Local paths are assumed to belong on $wgServer.
Definition at line 374 of file File.php.
References getUrl(), PROTO_RELATIVE, and wfExpandUrl().
File::getHandler | ( | ) |
Get a MediaHandler instance for this file.
Definition at line 1364 of file File.php.
References $handler, MediaHandler\getHandler(), getMimeType(), and handler.
Referenced by UnregisteredLocalFile\cachePageDimensions(), canAnimateThumbIfAppropriate(), canRender(), convertMetadataVersion(), formatMetadata(), generateAndSaveThumb(), generateBucketsIfNeeded(), generateThumbName(), getAvailableLanguages(), getCommonMetaArray(), getDefaultRenderLanguage(), getDimensionsString(), LocalFile\getHeight(), UnregisteredLocalFile\getImageSize(), getImageSize(), getLength(), getLongDesc(), UnregisteredLocalFile\getMetadata(), getShortDesc(), getStreamHeaders(), getThumbnailSource(), LocalFile\getWidth(), isExpensiveToThumbnail(), isMultipage(), isVectorized(), LocalFile\maybeUpgradeRow(), mustRender(), pageCount(), ForeignAPIFile\purgeThumbnails(), LocalFile\purgeThumbnails(), transform(), and transformErrorOutput().
File::getHashPath | ( | ) |
Get the filename hash component of the directory including trailing slash, e.g.
f/fa/ If the repository is not hashed, returns an empty string.
Definition at line 1496 of file File.php.
References $hashPath, assertRepoDefined(), and getName().
Referenced by getArchiveRel(), getArchiveThumbRel(), getArchiveThumbUrl(), getArchiveUrl(), getArchiveVirtualUrl(), OldLocalFile\getRel(), getRel(), ForeignAPIFile\getThumbPath(), OldLocalFile\getUrlRel(), getUrlRel(), LocalFile\publishTo(), and OldLocalFile\uploadOld().
File::getHeight | ( | $page = 1 | ) |
Return the height of the image.
Returns false if the height is unknown or undefined
STUB Overridden by LocalFile, UnregisteredLocalFile
int | $page |
Definition at line 476 of file File.php.
Referenced by getThumbnailSource().
File::getHistory | ( | $limit = null , |
|
$start = null , |
|||
$end = null , |
|||
$inc = true |
|||
) |
Return a fragment of the history of file.
STUB
int | $limit | Limit of rows to return |
string | $start | Only revisions older than $start will be returned |
string | $end | Only revisions newer than $end will be returned |
bool | $inc | Include the endpoints of the time range |
File::getImageSize | ( | $filePath | ) |
Get an image size array like that returned by getImageSize(), or false if it can't be determined.
Loads the image size directly from the file ignoring caches.
string | $filePath | The path to the file (e.g. From getLocalPathRef() ) |
Definition at line 2008 of file File.php.
References getHandler().
|
protected |
|
protected |
Uncached accessor.
Definition at line 807 of file File.php.
References $mime, $type, $wgTrustedMediaFormats, allowInlineDisplay(), getMediaType(), getMimeType(), global, isTrustedFile(), MEDIATYPE_UNKNOWN, not, and type.
Referenced by isSafeFile().
File::getLastError | ( | ) |
Get last thumbnailing error.
Largely obsolete.
Definition at line 1399 of file File.php.
References $lastError.
File::getLength | ( | ) |
Get the duration of a media file in seconds.
Definition at line 540 of file File.php.
References getHandler(), and MediaHandler\getLength().
File::getLocalRefPath | ( | ) |
Get an FS copy or original of this file and return the path.
Returns false on failure. Callers must not alter the file. Temporary files are cleared automatically.
Definition at line 432 of file File.php.
References $starttime, assertRepoDefined(), RequestContext\getMain(), and getPath().
Referenced by UnregisteredLocalFile\getBitDepth(), UnregisteredLocalFile\getImageSize(), UnregisteredLocalFile\getMetadata(), UnregisteredLocalFile\getMimeType(), MediaHandler\getPageDimensions(), and getThumbnailSource().
File::getLongDesc | ( | ) |
Definition at line 2165 of file File.php.
References MediaHandler\getGeneralLongDesc(), getHandler(), and MediaHandler\getLongDesc().
File::getMediaType | ( | ) |
Return the type of the media in the file.
Use the value returned by this function with the MEDIATYPE_xxx constants. Overridden by LocalFile, STUB
Definition at line 717 of file File.php.
References MEDIATYPE_UNKNOWN.
Referenced by getIsSafeFileUncached().
File::getMetadata | ( | ) |
Get handler-specific metadata Overridden by LocalFile, UnregisteredLocalFile STUB.
Definition at line 638 of file File.php.
Referenced by SvgHandler\getAvailableLanguages(), GIFHandler\getCommonMetaArray(), PNGHandler\getCommonMetaArray(), ExifBitmapHandler\getCommonMetaArray(), SvgHandler\getCommonMetaArray(), getStreamHeaders(), and DjVuHandler\getUnserializedMetadata().
File::getMimeType | ( | ) |
Returns the MIME type of the file.
Overridden by LocalFile, UnregisteredLocalFile STUB
Definition at line 706 of file File.php.
Referenced by checkExtensionCompatibility(), generateThumbName(), getHandler(), getIsSafeFileUncached(), and getViewURL().
File::getName | ( | ) |
Return the name of this file.
Definition at line 296 of file File.php.
References $name, assertRepoDefined(), name, and title.
Referenced by compare(), LocalRepo\findFiles(), LocalFile\getCacheKey(), ForeignDBFile\getDescriptionText(), getDescriptionText(), getDescriptionUrl(), getExtension(), getHashPath(), getRel(), LocalFile\getSha1(), ForeignAPIFile\getThumbnails(), getThumbnailSource(), ForeignAPIFile\getThumbPath(), getTransformScript(), getUrlRel(), getViewURL(), ImageHistoryList\imageHistoryLine(), OldLocalFile\loadExtraFromDB(), LocalFile\loadFieldsWithTimestamp(), OldLocalFile\loadFromDB(), LocalFile\loadFromDB(), LocalFile\publishTo(), ForeignAPIFile\purgeDescriptionPage(), PurgeChangedFiles\purgeFromArchiveTable(), LocalFile\purgeThumbList(), ForeignAPIFile\purgeThumbnails(), LocalFile\readOnlyFatalStatus(), OldLocalFile\recordOldUpload(), LocalFile\recordUpload2(), thumbName(), ForeignAPIFile\transform(), OldLocalFile\upgradeRow(), LocalFile\upgradeRow(), and wfGenerateThumbnail().
File::getOriginalTitle | ( | ) |
Return the title used to find this file.
Definition at line 334 of file File.php.
References $title, and getRedirectedTitle().
File::getPath | ( | ) |
Return the storage path to the file.
Note that this does not mean that a file actually exists under that location.
This path depends on whether directory hashing is active or not, i.e. whether the files are all found in the same directory, or in hashed paths like /images/3/3c.
Most callers don't check the return value, but ForeignAPIFile::getPath returns false.
Definition at line 416 of file File.php.
References $path, assertRepoDefined(), and getRel().
Referenced by LocalFile\acquireFileLock(), exists(), PurgeChangedFiles\getDeletedPath(), getLocalRefPath(), LocalFile\getSha1(), getSha1(), getTimestamp(), SpecialUploadStash\outputLocalFile(), LocalFile\releaseFileLock(), and RefreshFileHeaders\updateFileHeaders().
File::getRedirected | ( | ) |
File::getRedirectedTitle | ( | ) |
Definition at line 2208 of file File.php.
References $redirectTitle, Title\makeTitle(), and NS_FILE.
Referenced by getOriginalTitle().
File::getRel | ( | ) |
Get the path of the file relative to the public zone root.
This function is overridden in OldLocalFile to be like getArchiveRel().
Definition at line 1511 of file File.php.
References getHashPath(), and getName().
Referenced by getPath(), getThumbRel(), LocalFile\publish(), and LocalFile\recordUpload2().
File::getRepo | ( | ) |
Returns the repository.
Definition at line 1853 of file File.php.
References $repo.
Referenced by LocalFileMoveBatch\__construct(), LocalFile\acquireFileLock(), LocalFile\delete(), LocalFile\deleteOld(), LocalFile\move(), SpecialUploadStash\outputLocalFile(), LocalFile\publishTo(), LocalFile\readOnlyFatalStatus(), LocalFile\recordUpload2(), LocalFile\releaseFileLock(), LocalFile\restore(), RefreshFileHeaders\updateFileHeaders(), LocalFile\upload(), and wfGenerateThumbnail().
File::getRepoName | ( | ) |
File::getSha1 | ( | ) |
Get the SHA-1 base 36 hash of the file.
Definition at line 2116 of file File.php.
References assertRepoDefined(), and getPath().
Referenced by FormatMetadata\fetchExtendedMetadata(), generateThumbName(), DjVuHandler\getDimensionInfo(), getStorageKey(), and wfGenerateThumbnail().
File::getShortDesc | ( | ) |
Definition at line 2177 of file File.php.
References MediaHandler\getGeneralShortDesc(), getHandler(), and MediaHandler\getShortDesc().
File::getSize | ( | ) |
Return the size of the image file, in bytes Overridden by LocalFile, UnregisteredLocalFile STUB.
Definition at line 695 of file File.php.
Referenced by getThumbnailSource(), and SpecialUploadStash\outputLocalFile().
File::getStorageKey | ( | ) |
Get the deletion archive key, "<sha1>.<ext>".
Definition at line 2127 of file File.php.
References $ext, getExtension(), and getSha1().
File::getStreamHeaders | ( | ) |
Definition at line 2153 of file File.php.
References getHandler(), getMetadata(), and MediaHandler\getStreamHeaders().
File::getThumbDisposition | ( | $thumbName, | |
$dispositionType = 'inline' |
|||
) |
string | $thumbName | Thumbnail name |
string | $dispositionType | Type of disposition (either "attachment" or "inline") |
Definition at line 1339 of file File.php.
References $name, FileBackend\extensionFromPath(), getExtension(), and FileBackend\makeContentDisposition().
Referenced by generateAndSaveThumb().
File::getThumbnailBucket | ( | $desiredWidth, | |
$page = 1 |
|||
) |
Return the smallest bucket from $wgThumbnailBuckets which is at least $wgThumbnailMinimumBucketDistance larger than $desiredWidth.
The returned bucket, if any, will always be bigger than $desiredWidth.
int | $desiredWidth | |
int | $page |
Definition at line 489 of file File.php.
References $page, $wgThumbnailBuckets, $wgThumbnailMinimumBucketDistance, as, getWidth(), and global.
Referenced by generateBucketsIfNeeded(), and getThumbnailSource().
File::getThumbnails | ( | ) |
Get all thumbnail names previously generated for this file STUB Overridden by LocalFile.
Definition at line 1409 of file File.php.
Referenced by LocalFile\purgeOldThumbnails(), and LocalFile\purgeThumbnails().
File::getThumbnailSource | ( | $params | ) |
Returns the most appropriate source image for the thumbnail, given a target thumbnail size.
array | $params |
Definition at line 1241 of file File.php.
References $params, PoolCounterWork\execute(), getBucketThumbPath(), getHandler(), getHeight(), getLocalRefPath(), getName(), getSize(), getThumbnailBucket(), getWidth(), and use.
File::getThumbPath | ( | $suffix = false | ) |
Get the path of the thumbnail directory, or a particular file if $suffix is specified.
bool | string | $suffix | If not false, the name of a thumbnail file |
Definition at line 1610 of file File.php.
References assertRepoDefined(), and getThumbRel().
Referenced by generateAndSaveThumb(), getBucketThumbPath(), LocalFile\getThumbnails(), and transform().
File::getThumbRel | ( | $suffix = false | ) |
Get the path, relative to the thumbnail zone root, of the thumbnail directory or a particular file if $suffix is specified.
bool | string | $suffix | If not false, the name of a thumbnail file |
Definition at line 1540 of file File.php.
References $path, and getRel().
Referenced by getThumbPath(), and getTranscodedPath().
File::getThumbUrl | ( | $suffix = false | ) |
Get the URL of the thumbnail directory, or a particular file if $suffix is specified.
bool | string | $suffix | If not false, the name of a thumbnail file |
Definition at line 1692 of file File.php.
References getZoneUrl().
Referenced by generateAndSaveThumb(), LocalFile\purgeThumbnails(), and transform().
File::getThumbVirtualUrl | ( | $suffix = false | ) |
Get the virtual URL for a thumbnail file or directory.
bool | string | $suffix | If not false, the name of a thumbnail file |
Definition at line 1746 of file File.php.
References $path, assertRepoDefined(), and getUrlRel().
File::getTimestamp | ( | ) |
Get the 14-character timestamp of the file upload.
Definition at line 2094 of file File.php.
References assertRepoDefined(), and getPath().
Referenced by LocalRepo\findFiles(), and FormatMetadata\getExtendedMetadataFromFile().
File::getTitle | ( | ) |
Return the associated title object.
Definition at line 325 of file File.php.
References $title.
Referenced by FileDeleteForm\__construct(), LocalRepo\findFiles(), FormatMetadata\getExtendedMetadataFromFile(), LocalFile\prerenderThumbnails(), purgeDescription(), purgeEverything(), PurgeChangedFiles\purgeFromArchiveTable(), LocalFile\recordUpload(), LocalFile\recordUpload2(), and wasDeleted().
File::getTranscodedPath | ( | $suffix = false | ) |
Get the path of the transcoded directory, or a particular file if $suffix is specified.
bool | string | $suffix | If not false, the name of a media file |
Definition at line 1622 of file File.php.
References assertRepoDefined(), and getThumbRel().
File::getTranscodedUrl | ( | $suffix = false | ) |
Get the URL of the transcoded directory, or a particular file if $suffix is specified.
bool | string | $suffix | If not false, the name of a media file |
Definition at line 1702 of file File.php.
References getZoneUrl().
File::getTransformScript | ( | ) |
Definition at line 893 of file File.php.
References $transformScript, getName(), and wfAppendQuery().
Referenced by transform().
File::getUnscaledThumb | ( | $handlerParams = [] | ) |
Get a ThumbnailImage which is the same size as the source.
array | $handlerParams |
Definition at line 914 of file File.php.
References $handlerParams, $page, getWidth(), iconThumb(), and transform().
File::getUrl | ( | ) |
Return the URL of the file.
Definition at line 347 of file File.php.
References $ext, $url, assertRepoDefined(), getExtension(), and getUrlRel().
Referenced by RevDelFileItem\getApiData(), getCanonicalUrl(), getFullUrl(), getViewURL(), LocalFile\purgeCache(), and LocalFile\recordUpload2().
File::getUrlRel | ( | ) |
Get urlencoded path of the file relative to the public zone root.
This function is overridden in OldLocalFile to be like getArchiveUrl().
Definition at line 1555 of file File.php.
References getHashPath(), and getName().
Referenced by getThumbVirtualUrl(), getUrl(), getVirtualUrl(), and getZoneUrl().
File::getUser | ( | $type = 'text' | ) |
File::getViewURL | ( | ) |
Definition at line 388 of file File.php.
References canRender(), createThumb(), getMimeType(), getName(), getUrl(), getWidth(), mustRender(), and wfDebug().
File::getVirtualUrl | ( | $suffix = false | ) |
Get the public zone virtual URL for a current version source file.
bool | string | $suffix | If not false, the name of a thumbnail file |
Definition at line 1712 of file File.php.
References $path, assertRepoDefined(), and getUrlRel().
Referenced by LocalFile\isMissing(), LocalFile\loadFromFile(), and LocalFile\recordUpload2().
File::getVisibility | ( | ) |
File::getWidth | ( | $page = 1 | ) |
Return the width of the image.
Returns false if the width is unknown or undefined.
STUB Overridden by LocalFile, UnregisteredLocalFile
int | $page |
Definition at line 462 of file File.php.
Referenced by getThumbnailBucket(), getThumbnailSource(), getUnscaledThumb(), and getViewURL().
File::getZoneUrl | ( | $zone, | |
$suffix = false |
|||
) |
Get the URL of the zone directory, or a particular file if $suffix is specified.
string | $zone | Name of requested zone |
bool | string | $suffix | If not false, the name of a file in zone |
Definition at line 1675 of file File.php.
References $ext, $path, assertRepoDefined(), getExtension(), and getUrlRel().
Referenced by getThumbUrl(), and getTranscodedUrl().
File::iconThumb | ( | ) |
Get a ThumbnailImage representing a file type icon.
Definition at line 1377 of file File.php.
References $IP, $params, $wgResourceBasePath, as, getExtension(), and global.
Referenced by getUnscaledThumb(), and transform().
File::isCacheable | ( | ) |
File::isDeleted | ( | $field | ) |
Is this file a "deleted" file in a private archive? STUB.
int | $field | One of DELETED_* bitfield constants |
Definition at line 1874 of file File.php.
Referenced by FormatMetadata\fetchExtendedMetadata(), LocalRepo\findFiles(), and LocalFile\getDescription().
File::isExpensiveToThumbnail | ( | ) |
True if creating thumbnails from the file is large or otherwise resource-intensive.
Definition at line 2267 of file File.php.
References getHandler(), and MediaHandler\isExpensiveToThumbnail().
Referenced by wfGenerateThumbnail().
File::isHashed | ( | ) |
File::isLocal | ( | ) |
Returns true if the file comes from the local file repository.
Definition at line 1835 of file File.php.
Referenced by FileDeleteForm\haveDeletableFile().
File::isMultipage | ( | ) |
Returns 'true' if this file is a type which supports multiple pages, e.g.
DJVU or PDF. Note that this may be true even if the file in question only has a single page.
Definition at line 1958 of file File.php.
References getHandler(), and handler.
Referenced by LocalFile\getHeight(), and LocalFile\getWidth().
File::isOld | ( | ) |
Returns true if the image is an old version STUB.
Definition at line 1863 of file File.php.
Referenced by LocalRepo\findFiles().
File::isSafeFile | ( | ) |
Determines if this media file is in a format that is unlikely to contain viruses or malicious content.
It uses the global $wgTrustedMediaFormats list to determine if the file is safe.
This is used to show a warning on the description page of non-safe files. It may also be used to disallow direct [[media:...]] links to such files.
Note that this function will always return true if allowInlineDisplay() or isTrustedFile() is true for this file.
Definition at line 785 of file File.php.
References $isSafeFile, and getIsSafeFileUncached().
Referenced by getIsSafeFile().
File::isTransformedLocally | ( | ) |
File::isTrustedFile | ( | ) |
Returns true if the file is flagged as trusted.
Files flagged that way can be linked to directly, even if that is not allowed for this type of file normally.
This is a dummy function right now and always returns false. It could be implemented to extract a flag from the database. The trusted flag could be set on upload, if the user has sufficient privileges, to bypass script- and html-filters. It may even be coupled with cryptographics signatures or such.
Definition at line 851 of file File.php.
Referenced by getIsSafeFileUncached().
File::isVectorized | ( | ) |
Return true if the file is vectorized.
Definition at line 554 of file File.php.
References getHandler(), and MediaHandler\isVectorized().
Referenced by LocalFile\prerenderThumbnails().
File::isVisible | ( | ) |
File::load | ( | $flags = 0 | ) |
|
protected |
Creates a temp FS file with the same extension and the thumbnail.
string | $thumbPath | Thumbnail path |
Definition at line 1329 of file File.php.
References FileBackend\extensionFromPath(), TempFSFile\factory(), and wfTempDir().
Referenced by generateBucketsIfNeeded(), and transform().
File::migrateThumbFile | ( | $thumbName | ) |
Hook into transform() to allow migration of thumbnail files STUB Overridden by LocalFile.
string | $thumbName |
File::move | ( | $target | ) |
Move file to the new title.
Move current, old version and all thumbnails to the new filename. Old file is deleted.
Cache purging is done; checks for validity and logging are caller's responsibility
Title | $target | New file name |
Definition at line 1910 of file File.php.
References readOnlyError().
File::mustRender | ( | ) |
Return true if the file is of a type that can't be directly rendered by typical browsers and needs to be re-rasterized.
This returns true for everything but the bitmap types supported by all browsers, i.e. JPEG; GIF and PNG. It will also return true for any non-image formats.
Definition at line 759 of file File.php.
References getHandler(), and handler.
Referenced by getViewURL().
File::nextHistoryLine | ( | ) |
|
static |
Normalize a file extension to the common form, making it lowercase and checking some synonyms, and ensure it's clean.
Extensions with non-alphanumeric characters will be discarded. Keep in sync with mw.Title.normalizeExtension() in JS.
string | $extension | File extension (without the leading dot) |
Definition at line 223 of file File.php.
Referenced by UploadStash\getExtensionForPath(), and LocalRepo\hiddenFileHasKey().
|
static |
Given a string or Title object return either a valid Title object with namespace NS_FILE or null.
Title | string | $title | |
string | bool | $exception | Use 'exception' to throw an error on bad titles |
MWException |
Definition at line 183 of file File.php.
References $ret, $title, Title\makeTitleSafe(), NS_FILE, and NS_MEDIA.
Referenced by UnregisteredLocalFile\__construct(), ArchivedFile\__construct(), LocalRepo\checkRedirect(), RepoGroup\findFile(), FileRepo\findFile(), RepoGroup\findFiles(), LocalRepo\findFiles(), FileRepo\findFiles(), and FileRepo\newFile().
File::pageCount | ( | ) |
Returns the number of pages of a multipage document, or false for documents which aren't multipage documents.
Definition at line 1968 of file File.php.
References $pageCount, getHandler(), and handler.
Referenced by MediaHandler\getEntireText().
File::publish | ( | $src, | |
$flags = 0 , |
|||
array | $options = [] |
||
) |
Move or copy a file to its public location.
If a file exists at the destination, move it to an archive. Returns a FileRepoStatus object with the archive name in the "value" member on success.
The archive name should be passed through to recordUpload for database registration.
Options to $options include:
string | FSFile | $src | Local filesystem path to the source image |
int | $flags | A bitwise combination of: File::DELETE_SOURCE Delete the source file, i.e. move rather than copy |
array | $options | Optional additional parameters |
STUB Overridden by LocalFile
Definition at line 1814 of file File.php.
References readOnlyError().
File::purgeCache | ( | $options = [] | ) |
Purge shared caches such as thumbnails and DB data caching STUB Overridden by LocalFile.
array | $options | Options, which include: 'forThumbRefresh' : The purging is only to refresh thumbnails |
Definition at line 1420 of file File.php.
Referenced by purgeEverything().
File::purgeDescription | ( | ) |
Purge the file description page, but don't go after pages using the file.
Use when modifying file history but not the current data.
Definition at line 1428 of file File.php.
References getTitle().
Referenced by LocalFile\deleteOld(), and purgeEverything().
File::purgeEverything | ( | ) |
Purge metadata and all affected pages when the file is created, deleted, or majorly updated.
Definition at line 1440 of file File.php.
References DeferredUpdates\addUpdate(), getTitle(), purgeCache(), and purgeDescription().
Referenced by LocalFile\delete().
File::readOnlyError | ( | ) |
MWException |
Definition at line 1768 of file File.php.
Referenced by ForeignDBFile\delete(), delete(), ForeignDBFile\move(), move(), ForeignDBFile\publish(), publish(), ForeignDBFile\recordUpload(), recordUpload(), ForeignDBFile\restore(), and restore().
File::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.
string | $oldver | |
string | $desc | |
string | $license | |
string | $copyStatus | |
string | $source | |
bool | $watch | |
string | bool | $timestamp | |
null | User | $user | User object or null to use $wgUser |
MWException |
Definition at line 1787 of file File.php.
References readOnlyError().
File::redirectedFrom | ( | $from | ) |
string | $from |
Definition at line 2224 of file File.php.
References $from.
Referenced by LocalRepo\findFiles().
File::resetHistory | ( | ) |
Reset the history pointer to the first element of the history.
Always call this function after using nextHistoryLine() to free db resources STUB Overridden in LocalFile.
File::restore | ( | $versions = [] , |
|
$unsuppress = false |
|||
) |
Restore all or specified deleted revisions to the given file.
Permissions and logging are left to the caller.
May throw database exceptions on error.
array | $versions | Set of record ids of deleted items to restore, or empty to restore all revisions. |
bool | $unsuppress | Remove restrictions on content upon restoration? |
Definition at line 1947 of file File.php.
References readOnlyError().
|
static |
Calculate the height of a thumbnail using the source and destination width.
int | $srcWidth | |
int | $srcHeight | |
int | $dstWidth |
Definition at line 1989 of file File.php.
Referenced by ImageHandler\normaliseParams(), SvgHandler\normaliseParams(), and ImageHandler\validateThumbParams().
|
static |
Split an internet media type into its two components; if not a two-part name, set the minor type to 'unknown'.
string | $mime | "text/html" etc |
Definition at line 272 of file File.php.
References $mime.
Referenced by MIMEsearchPage\execute(), RefreshImageMetadata\getConditions(), MWFileProps\getPropsFromPath(), and ApiQueryAllImages\run().
File::thumbName | ( | $params, | |
$flags = 0 |
|||
) |
Return the file name of a thumbnail with the specified parameters.
Use File::THUMB_FULL_NAME to always get a name like "<params>-<source>". Otherwise, the format may be "<params>-<source>" or "<params>-thumbnail.<ext>".
array | $params | Handler-specific parameters |
int | $flags | Bitfield that supports THUMB_* constants |
Definition at line 937 of file File.php.
References $flags, $params, generateThumbName(), and getName().
Referenced by generateAndSaveThumb(), getBucketThumbName(), and transform().
File::transform | ( | $params, | |
$flags = 0 |
|||
) |
Transform a media file.
array | $params | An associative array of handler-specific parameters. Typical keys are width, height and page. |
int | $flags | A bitfield, may contain self::RENDER_NOW to force rendering |
Definition at line 1033 of file File.php.
References $flags, $params, $timestamp, $wgThumbnailEpoch, canRender(), false, generateAndSaveThumb(), getDescriptionUrl(), getHandler(), MediaHandler\getScriptedTransform(), getThumbPath(), getThumbUrl(), MediaHandler\getTransform(), getTransformScript(), global, iconThumb(), makeTransformTmpFile(), MediaHandler\normaliseParams(), PROTO_CANONICAL, thumbName(), transformErrorOutput(), wfDebug(), and wfExpandUrl().
Referenced by createThumb(), getUnscaledThumb(), and wfGenerateThumbnail().
|
protected |
Return either a MediaTransformError or placeholder thumbnail (if $wgIgnoreImageErrors)
string | $thumbPath | Thumbnail storage path |
string | $thumbUrl | Thumbnail URL |
array | $params | |
int | $flags |
Definition at line 1013 of file File.php.
References $flags, $params, $wgIgnoreImageErrors, getHandler(), MediaHandler\getTransform(), global, text, and wfMessage().
Referenced by generateAndSaveThumb(), and transform().
File::upgradeRow | ( | ) |
File::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 deleted.
STUB
Definition at line 2146 of file File.php.
Referenced by LocalRepo\findFiles(), and LocalFile\getDescription().
File::wasDeleted | ( | ) |
Was this file ever deleted from the wiki?
Definition at line 1892 of file File.php.
References getTitle().
|
protected |
Whether the output of transform() for this file is likely to be valid.
Definition at line 142 of file File.php.
Referenced by canRender().
|
protected |
|
protected |
False if undefined.
Definition at line 110 of file File.php.
Referenced by UnregisteredLocalFile\setLocalReference().
|
protected |
Definition at line 113 of file File.php.
Referenced by getHandler(), LocalFile\getHeight(), LocalFile\getWidth(), LocalFile\maybeUpgradeRow(), ForeignAPIFile\purgeThumbnails(), LocalFile\purgeThumbnails(), and LocalFile\upload().
|
protected |
Relative path including trailing slash.
Definition at line 128 of file File.php.
Referenced by getHashPath().
|
protected |
Whether this media file is in a format that is unlikely to contain viruses or malicious content.
Definition at line 147 of file File.php.
Referenced by isSafeFile().
|
protected |
|
protected |
The name of a file from its title object.
Definition at line 122 of file File.php.
Referenced by UnregisteredLocalFile\__construct(), generateThumbName(), getName(), getThumbDisposition(), OldLocalFile\loadExtraFromDB(), LocalFile\loadExtraFromDB(), LocalFile\loadFromRow(), and LocalFile\unprefixRow().
|
protected |
Number of pages of a multipage document, or false for documents which aren't multipage documents.
Definition at line 133 of file File.php.
Referenced by pageCount().
|
protected |
The storage path corresponding to one of the zones.
Definition at line 125 of file File.php.
Referenced by getArchiveRel(), getArchiveThumbRel(), getArchiveThumbUrl(), getArchiveUrl(), getArchiveVirtualUrl(), getPath(), ForeignAPIFile\getThumbPath(), getThumbRel(), getThumbVirtualUrl(), getVirtualUrl(), and getZoneUrl().
|
protected |
Main part of the title, with underscores (Title::getDBkey)
Definition at line 104 of file File.php.
Referenced by getRedirected().
|
protected |
Definition at line 139 of file File.php.
Referenced by getRedirectedTitle().
FileRepo LocalRepo ForeignAPIRepo bool File::$repo |
Some member variables can be lazy-initialised using __get().
The initialisation function for these variables is always a function named like getVar(), where Var is the variable name with upper-case first letter.
The following variables are initialised in this way in this base class: name, extension, handler, path, canRender, isSafeFile, transformScript, hashPath, pageCount, url
Code within this class should generally use the accessor function directly, since __get() isn't re-entrant and therefore causes bugs that depend on initialisation order. The following member variables are not lazy-initialised
Definition at line 95 of file File.php.
Referenced by ForeignAPIFile\__construct(), UnregisteredLocalFile\__construct(), OldLocalFile\__construct(), __construct(), LocalFile\__construct(), UploadStashFile\__construct(), getRepo(), OldLocalFile\newFromArchiveName(), OldLocalFile\newFromKey(), LocalFile\newFromKey(), ForeignDBFile\newFromRow(), OldLocalFile\newFromRow(), LocalFile\newFromRow(), ForeignDBFile\newFromTitle(), OldLocalFile\newFromTitle(), ForeignAPIFile\newFromTitle(), UnregisteredLocalFile\newFromTitle(), LocalFile\newFromTitle(), and LocalFile\publishTo().
Definition at line 98 of file File.php.
Referenced by ForeignAPIFile\__construct(), OldLocalFile\__construct(), __construct(), LocalFile\__construct(), getOriginalTitle(), getTitle(), OldLocalFile\newFromArchiveName(), ForeignDBFile\newFromRow(), OldLocalFile\newFromRow(), LocalFile\newFromRow(), ForeignDBFile\newFromTitle(), OldLocalFile\newFromTitle(), ForeignAPIFile\newFromTitle(), LocalFile\newFromTitle(), and normalizeTitle().
|
protected |
|
protected |
URL of transformscript (for example thumb.php)
Definition at line 136 of file File.php.
Referenced by getTransformScript().
|
protected |
The URL corresponding to one of the four basic zones.
Definition at line 116 of file File.php.
Referenced by ForeignDBFile\getDescriptionShortUrl(), ForeignAPIFile\getDescriptionShortUrl(), LocalFile\getDescriptionShortUrl(), getUrl(), and ForeignAPIFile\purgeDescriptionPage().
const File::DELETE_SOURCE = 1 |
Definition at line 65 of file File.php.
Referenced by UploadBase\performUpload(), and LocalFile\publishTo().
const File::DELETED_COMMENT = 2 |
Definition at line 53 of file File.php.
Referenced by ApiQueryFilearchive\execute(), RevDelFileItem\getComment(), ArchivedFile\getDescription(), SpecialUndelete\getFileComment(), ApiQueryImageInfo\getInfo(), ImageHistoryList\imageHistoryLine(), and XmlDumpWriter\writeUpload().
const File::DELETED_FILE = 1 |
Definition at line 52 of file File.php.
Referenced by LocalFileMoveBatch\addOlds(), RevDelFileItem\canViewContent(), UploadBase\checkWarnings(), ApiQueryFilearchive\execute(), DeleteArchivedFiles\execute(), MigrateFileRepoLayout\execute(), SpecialUndelete\execute(), LocalFileRestoreBatch\execute(), FormatMetadata\fetchExtendedMetadata(), FileRepo\findFile(), FileRepo\findFileFromKey(), LocalRepo\findFiles(), SpecialUndelete\getFileLink(), ApiQueryImageInfo\getInfo(), RevDelFileList\getRevdelConstant(), ImageHistoryList\getThumbForLine(), LocalRepo\hiddenFileHasKey(), ImageHistoryList\imageHistoryLine(), RevDelFileItem\isDeleted(), OldLocalFile\isVisible(), RevDelFileItem\setBits(), SpecialRevisionDelete\tryShowFile(), and wfStreamThumb().
const File::DELETED_RESTRICTED = 8 |
Definition at line 55 of file File.php.
Referenced by RevDelFileItem\canView(), ApiQueryFilearchive\execute(), SpecialUndelete\execute(), SpecialUndelete\formatFileRow(), ApiQueryImageInfo\getInfo(), RevDelFileList\getSuppressBit(), ImageHistoryList\imageHistoryLine(), and SpecialRevisionDelete\tryShowFile().
const File::DELETED_USER = 4 |
Definition at line 54 of file File.php.
Referenced by ApiQueryFilearchive\execute(), SpecialUndelete\getFileUser(), ApiQueryImageInfo\getInfo(), ArchivedFile\getUserText(), and ImageHistoryList\imageHistoryLine().
const File::FOR_THIS_USER = 2 |
Definition at line 69 of file File.php.
Referenced by ImageHistoryList\imageHistoryLine().
const File::RAW = 3 |
Definition at line 70 of file File.php.
Referenced by ApiQueryImageInfo\getInfo().
const File::RENDER_FORCE = 2 |
Force rendering even if thumbnail already exist and using RENDER_NOW I.e.
you have to pass both flags: File::RENDER_NOW | File::RENDER_FORCE
Definition at line 63 of file File.php.
Referenced by JpegPixelFormatTest\testPixelFormatRendering(), ExifRotationTest\testRotationRendering(), and ExifRotationTest\testRotationRenderingNoAutoRotate().
const File::RENDER_NOW = 1 |
Force rendering in the current process.
Definition at line 58 of file File.php.
Referenced by SpecialUploadStash\outputLocallyScaledThumb(), ThumbnailRenderJob\run(), JpegPixelFormatTest\testPixelFormatRendering(), ExifRotationTest\testRotationRendering(), ExifRotationTest\testRotationRenderingNoAutoRotate(), and wfGenerateThumbnail().
const File::THUMB_FULL_NAME = 1 |
Definition at line 73 of file File.php.
Referenced by wfStreamThumb().