MediaWiki
REL1_20
|
Class representing a non-directory file on the file system. More...
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 |
Class representing a non-directory file on the file system.
Definition at line 29 of file FSFile.php.
FSFile::__construct | ( | $ | path | ) |
Sets up the file object.
$path | string Path to temporary file on local disk |
MWException |
Definition at line 38 of file FSFile.php.
References $path, and FileBackend\isStoragePath().
FSFile::exists | ( | ) |
Checks if the file exists.
Definition at line 59 of file FSFile.php.
Referenced by getProps().
static FSFile::extensionFromPath | ( | $ | path | ) | [static] |
Get the final file extension from a file system path.
$path | string |
Definition at line 218 of file FSFile.php.
References $path.
Referenced by getProps().
FSFile::extractImageSizeInfo | ( | array $ | gis | ) | [protected] |
Exract image size information.
$gis | array |
Definition at line 176 of file FSFile.php.
Referenced by getProps().
Guess the MIME type from the file contents alone.
Definition at line 92 of file FSFile.php.
References MimeMagic\singleton().
Referenced by getProps().
FSFile::getPath | ( | ) |
FSFile::getProps | ( | $ | ext = true | ) |
Get an associative array containing information about a file with the given storage path.
$ext | Mixed: the file extension, or true to extract it from the filename. Set it to false to ignore the extension. |
Definition at line 105 of file FSFile.php.
References $ext, exists(), extensionFromPath(), extractImageSizeInfo(), MediaHandler\getHandler(), getMimeType(), getSha1Base36(), getSize(), placeholderProps(), MimeMagic\singleton(), File\splitMime(), wfDebug(), wfProfileIn(), and wfProfileOut().
static FSFile::getPropsFromPath | ( | $ | path, |
$ | ext = true |
||
) | [static] |
Get an associative array containing information about a file in the local filesystem.
$path | String: absolute local filesystem path |
$ext | Mixed: the file extension, or true to extract it from the filename. Set it to false to ignore the extension. |
Definition at line 232 of file FSFile.php.
Referenced by FileBackendTest\doTestStore(), UploadBase\verifyFile(), and UploadBase\verifyPartialFile().
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.
Definition at line 198 of file FSFile.php.
References wfBaseConvert(), wfProfileIn(), wfProfileOut(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by getProps().
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.
$path | string |
Definition at line 248 of file FSFile.php.
References $path.
Referenced by UploadBase\checkWarnings(), and ApiTestCaseUpload\deleteFileByContent().
FSFile::getSize | ( | ) |
Get the file size in bytes.
Definition at line 68 of file FSFile.php.
Referenced by getProps().
Get the file's last-modified timestamp.
Definition at line 77 of file FSFile.php.
References wfRestoreWarnings(), wfSuppressWarnings(), and wfTimestamp().
static FSFile::placeholderProps | ( | ) | [static] |
Placeholder file properties to use for files that don't exist.
Definition at line 157 of file FSFile.php.
Referenced by getProps().
FSFile::$path [protected] |
Definition at line 30 of file FSFile.php.
Referenced by __construct(), extensionFromPath(), TempFSFile\factory(), getPropsFromPath(), and getSha1Base36FromPath().