MediaWiki  REL1_19
ForeignAPIFile Class Reference

Foreign file accessible through api.php requests. More...

Inheritance diagram for ForeignAPIFile:
Collaboration diagram for ForeignAPIFile:

List of all members.

Public Member Functions

 __construct ($title, $repo, $info, $exists=false)
 exists ()
 Returns true if file exists in the repository.
 getDescription ()
 Get discription of file revision STUB.
 getDescriptionUrl ()
 Get the URL of the image description page.
 getHeight ($page=1)
 getMediaType ()
 getMetadata ()
 Get handler-specific metadata Overridden by LocalFile, UnregisteredLocalFile STUB.
 getMimeType ()
 Returns the mime type of the file.
 getPath ()
 Return the storage path to the file.
 getSha1 ()
 Get the SHA-1 base 36 hash of the file.
 getSize ()
 Return the size of the image file, in bytes Overridden by LocalFile, UnregisteredLocalFile STUB.
 getThumbnails ()
 Get all thumbnail names previously generated for this file STUB Overridden by LocalFile.
 getThumbPath ($suffix= '')
 Only useful if we're locally caching thumbs anyway...
 getTimestamp ()
 Get the 14-character timestamp of the file upload.
 getUrl ()
 Return the URL of the file.
 getUser ($method='text')
 Returns ID or name of user who uploaded the file STUB.
 getWidth ($page=1)
 Return the width of the image.
 purgeCache ($options=array())
 purgeDescriptionPage ()
 purgeThumbnails ($options=array())
 transform ($params, $flags=0)
 Transform a media file.

Static Public Member Functions

static getProps ()
 Get the property string for iiprop and aiprop.
static newFromTitle (Title $title, $repo)
static parseMetadata ($metadata)

Protected Attributes

 $repoClass = 'ForeignApiRepo'

Private Attributes

 $mExists

Detailed Description

Foreign file accessible through api.php requests.

Very hacky and inefficient, do not use :D

Definition at line 15 of file ForeignAPIFile.php.


Constructor & Destructor Documentation

ForeignAPIFile::__construct ( title,
repo,
info,
exists = false 
)
Parameters:
$title
$repoForeignApiRepo
$info
bool$exists

Definition at line 26 of file ForeignAPIFile.php.

References File\$repo, File\$title, and File\assertRepoDefined().

Here is the call graph for this function:


Member Function Documentation

Returns true if file exists in the repository.

Overridden by LocalFile to avoid unnecessary stat calls.

Returns:
boolean Whether file exists in the repository.

Reimplemented from File.

Definition at line 77 of file ForeignAPIFile.php.

Get discription of file revision STUB.

Returns:
string

Reimplemented from File.

Definition at line 146 of file ForeignAPIFile.php.

Get the URL of the image description page.

May return false if it is unknown or not applicable.

Returns:
string

Reimplemented from File.

Definition at line 178 of file ForeignAPIFile.php.

ForeignAPIFile::getHeight ( page = 1)
Parameters:
$pageint
Returns:
int

Reimplemented from File.

Definition at line 112 of file ForeignAPIFile.php.

Todo:
FIXME: May guess wrong on file types that can be eg audio or video

Reimplemented from File.

Definition at line 173 of file ForeignAPIFile.php.

References getMimeType(), and MimeMagic\singleton().

Here is the call graph for this function:

Get handler-specific metadata Overridden by LocalFile, UnregisteredLocalFile STUB.

Reimplemented from File.

Definition at line 116 of file ForeignAPIFile.php.

Returns the mime type of the file.

Overridden by LocalFile, UnregisteredLocalFile STUB

Returns:
string

Reimplemented from File.

Definition at line 164 of file ForeignAPIFile.php.

References File\getExtension(), and MimeMagic\singleton().

Referenced by getMediaType().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Returns:
string|false

Reimplemented from File.

Definition at line 81 of file ForeignAPIFile.php.

static ForeignAPIFile::getProps ( ) [static]

Get the property string for iiprop and aiprop.

Definition at line 72 of file ForeignAPIFile.php.

Referenced by ForeignAPIRepo\findBySha1(), and newFromTitle().

Here is the caller graph for this function:

Get the SHA-1 base 36 hash of the file.

Returns:
string

Reimplemented from File.

Definition at line 150 of file ForeignAPIFile.php.

References wfBaseConvert().

Here is the call graph for this function:

Return the size of the image file, in bytes Overridden by LocalFile, UnregisteredLocalFile STUB.

Reimplemented from File.

Definition at line 134 of file ForeignAPIFile.php.

Get all thumbnail names previously generated for this file STUB Overridden by LocalFile.

Reimplemented from File.

Definition at line 199 of file ForeignAPIFile.php.

References $dir, $file, $files, File\getName(), and getThumbPath().

Referenced by purgeThumbnails().

Here is the call graph for this function:

Here is the caller graph for this function:

ForeignAPIFile::getThumbPath ( suffix = '')

Only useful if we're locally caching thumbs anyway...

Reimplemented from File.

Definition at line 187 of file ForeignAPIFile.php.

References File\$path, File\getHashPath(), and File\getName().

Referenced by getThumbnails(), and purgeThumbnails().

Here is the call graph for this function:

Here is the caller graph for this function:

Get the 14-character timestamp of the file upload.

Returns:
string|false TS_MW timestamp or false on failure

Reimplemented from File.

Definition at line 156 of file ForeignAPIFile.php.

References wfTimestamp().

Here is the call graph for this function:

Return the URL of the file.

Returns:
string

Reimplemented from File.

Definition at line 138 of file ForeignAPIFile.php.

ForeignAPIFile::getUser ( type = 'text')

Returns ID or name of user who uploaded the file STUB.

Parameters:
$typestring 'text' or 'id'
Returns:
string|int

Reimplemented from File.

Definition at line 142 of file ForeignAPIFile.php.

ForeignAPIFile::getWidth ( page = 1)

Return the width of the image.

Returns false if the width is unknown or undefined.

STUB Overridden by LocalFile, UnregisteredLocalFile

Parameters:
$pageint
Returns:
number

Reimplemented from File.

Definition at line 104 of file ForeignAPIFile.php.

static ForeignAPIFile::newFromTitle ( Title title,
repo 
) [static]
Parameters:
$titleTitle
$repoForeignApiRepo
Returns:
ForeignAPIFile|null

Definition at line 40 of file ForeignAPIFile.php.

References File\$repo, File\$title, Title\getDBkey(), MediaHandler\getMetadataVersion(), getProps(), and Title\newFromText().

Here is the call graph for this function:

static ForeignAPIFile::parseMetadata ( metadata) [static]

Definition at line 123 of file ForeignAPIFile.php.

ForeignAPIFile::purgeCache ( options = array())
See also:
File::purgeCache()

Reimplemented from File.

Definition at line 214 of file ForeignAPIFile.php.

References $options, purgeDescriptionPage(), and purgeThumbnails().

Here is the call graph for this function:

Definition at line 219 of file ForeignAPIFile.php.

References File\$url, $wgContLang, $wgMemc, and File\getName().

Referenced by purgeCache().

Here is the call graph for this function:

Here is the caller graph for this function:

ForeignAPIFile::purgeThumbnails ( options = array())

Definition at line 228 of file ForeignAPIFile.php.

References $dir, $file, $files, File\$handler, $options, $wgMemc, File\getHandler(), File\getName(), getThumbnails(), getThumbPath(), and FileRepo\SKIP_LOCKING.

Referenced by purgeCache().

Here is the call graph for this function:

Here is the caller graph for this function:

ForeignAPIFile::transform ( params,
flags = 0 
)

Transform a media file.

Parameters:
$paramsArray: an associative array of handler-specific parameters. Typical keys are width, height and page.
$flagsInteger: a bitfield, may contain self::RENDER_NOW to force rendering
Returns:
MediaTransformOutput|false

Reimplemented from File.

Definition at line 85 of file ForeignAPIFile.php.

References File\canRender(), and File\getName().

Here is the call graph for this function:


Member Data Documentation

ForeignAPIFile::$mExists [private]

Definition at line 16 of file ForeignAPIFile.php.

ForeignAPIFile::$repoClass = 'ForeignApiRepo' [protected]

Reimplemented from File.

Definition at line 18 of file ForeignAPIFile.php.


The documentation for this class was generated from the following file: