MediaWiki  REL1_19
FSFile Class Reference

Class representing a non-directory file on the file system. More...

Inheritance diagram for FSFile:

List of all members.

Public Member Functions

 __construct ($path)
 Sets up the file object.
 exists ()
 Checks if the file exists.
 getMimeType ()
 Guess the MIME type from the file contents alone.
 getPath ()
 Returns the file system path.
 getProps ($ext=true)
 Get an associative array containing information about a file with the given storage path.
 getSha1Base36 ()
 Get a SHA-1 hash of a file in the local filesystem, in base-36 lower case encoding, zero padded to 31 digits.
 getSize ()
 Get the file size in bytes.
 getTimestamp ()
 Get the file's last-modified timestamp.

Static Public Member Functions

static extensionFromPath ($path)
 Get the final file extension from a file system path.
static getPropsFromPath ($path, $ext=true)
 Get an associative array containing information about a file in the local filesystem.
static getSha1Base36FromPath ($path)
 Get a SHA-1 hash of a file in the local filesystem, in base-36 lower case encoding, zero padded to 31 digits.
static placeholderProps ()
 Placeholder file properties to use for files that don't exist.

Protected Member Functions

 extractImageSizeInfo (array $gis)
 Exract image size information.

Protected Attributes

 $path

Detailed Description

Class representing a non-directory file on the file system.

Definition at line 12 of file FSFile.php.


Constructor & Destructor Documentation

FSFile::__construct ( path)

Sets up the file object.

Parameters:
String$pathPath to temporary file on local disk

Definition at line 20 of file FSFile.php.

References $path, and FileBackend\isStoragePath().

Here is the call graph for this function:


Member Function Documentation

Checks if the file exists.

Returns:
bool

Definition at line 41 of file FSFile.php.

Referenced by getProps().

Here is the caller graph for this function:

static FSFile::extensionFromPath ( path) [static]

Get the final file extension from a file system path.

Parameters:
$pathstring
Returns:
string

Definition at line 199 of file FSFile.php.

References $path.

Referenced by getProps().

Here is the caller graph for this function:

FSFile::extractImageSizeInfo ( array $  gis) [protected]

Exract image size information.

Returns:
Array

Definition at line 157 of file FSFile.php.

Referenced by getProps().

Here is the caller graph for this function:

Guess the MIME type from the file contents alone.

Returns:
string

Definition at line 74 of file FSFile.php.

References MimeMagic\singleton().

Referenced by getProps().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the file system path.

Returns:
String

Definition at line 32 of file FSFile.php.

FSFile::getProps ( ext = true)

Get an associative array containing information about a file with the given storage path.

Parameters:
$extMixed: the file extension, or true to extract it from the filename. Set it to false to ignore the extension.
Returns:
array

Definition at line 87 of file FSFile.php.

References $ext, exists(), extensionFromPath(), extractImageSizeInfo(), MediaHandler\getHandler(), getMimeType(), getSha1Base36(), getSize(), placeholderProps(), MimeMagic\singleton(), File\splitMime(), wfDebug(), wfProfileIn(), and wfProfileOut().

Here is the call graph for this function:

static FSFile::getPropsFromPath ( path,
ext = true 
) [static]

Get an associative array containing information about a file in the local filesystem.

Parameters:
$pathString: absolute local filesystem path
$extMixed: the file extension, or true to extract it from the filename. Set it to false to ignore the extension.
Returns:
array

Definition at line 213 of file FSFile.php.

References $ext, and $path.

Referenced by FileBackendTest\doTestStore(), RepoGroup\getFileProps(), UploadStash\stashFile(), UploadBase\verifyFile(), and UploadBase\verifyPartialFile().

Here is the caller graph for this function:

Get a SHA-1 hash of a file in the local filesystem, in base-36 lower case encoding, zero padded to 31 digits.

160 log 2 / log 36 = 30.95, so the 160-bit hash fills 31 digits in base 36 fairly neatly.

Returns:
false|string False on failure

Definition at line 179 of file FSFile.php.

References wfBaseConvert(), wfProfileIn(), wfProfileOut(), wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by getProps().

Here is the call graph for this function:

Here is the caller graph for this function:

static FSFile::getSha1Base36FromPath ( path) [static]

Get a SHA-1 hash of a file in the local filesystem, in base-36 lower case encoding, zero padded to 31 digits.

160 log 2 / log 36 = 30.95, so the 160-bit hash fills 31 digits in base 36 fairly neatly.

Parameters:
$pathstring
Returns:
false|string False on failure

Definition at line 229 of file FSFile.php.

References $path.

Referenced by UploadBase\checkWarnings(), and ApiTestCaseUpload\deleteFileByContent().

Here is the caller graph for this function:

Get the file size in bytes.

Returns:
int|false

Definition at line 50 of file FSFile.php.

Referenced by getProps().

Here is the caller graph for this function:

Get the file's last-modified timestamp.

Returns:
string|false TS_MW timestamp or false on failure

Definition at line 59 of file FSFile.php.

References wfRestoreWarnings(), wfSuppressWarnings(), and wfTimestamp().

Here is the call graph for this function:

static FSFile::placeholderProps ( ) [static]

Placeholder file properties to use for files that don't exist.

Returns:
Array

Definition at line 139 of file FSFile.php.

Referenced by FileBackendStore\getFileProps(), and getProps().

Here is the caller graph for this function:


Member Data Documentation

FSFile::$path [protected]

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