MediaWiki
1.23.2
|
Class representing a non-directory file on the file system. More...
Public Member Functions | |
__construct ( $path) | |
Sets up the file object. More... | |
exists () | |
Checks if the file exists. More... | |
getMimeType () | |
Guess the MIME type from the file contents alone. More... | |
getPath () | |
Returns the file system path. More... | |
getProps ( $ext=true) | |
Get an associative array containing information about a file with the given storage path. More... | |
getSha1Base36 ( $recache=false) | |
Get a SHA-1 hash of a file in the local filesystem, in base-36 lower case encoding, zero padded to 31 digits. More... | |
getSize () | |
Get the file size in bytes. More... | |
getTimestamp () | |
Get the file's last-modified timestamp. More... | |
Static Public Member Functions | |
static | extensionFromPath ( $path) |
Get the final file extension from a file system path. More... | |
static | getPropsFromPath ( $path, $ext=true) |
Get an associative array containing information about a file in the local filesystem. More... | |
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. More... | |
static | placeholderProps () |
Placeholder file properties to use for files that don't exist. More... | |
Protected Member Functions | |
extractImageSizeInfo (array $gis) | |
Exract image size information. More... | |
Protected Attributes | |
string | $path |
Path to file *. More... | |
string | $sha1Base36 |
File SHA-1 in base 36 *. More... | |
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.
string | $path | Path to temporary file on local disk |
Definition at line 39 of file FSFile.php.
References $path.
FSFile::exists | ( | ) |
Checks if the file exists.
Reimplemented in MockFSFile.
Definition at line 57 of file FSFile.php.
Referenced by getProps().
|
static |
Get the final file extension from a file system path.
string | $path |
Definition at line 229 of file FSFile.php.
References $path.
Referenced by getProps().
|
protected |
Exract image size information.
array | $gis |
Definition at line 177 of file FSFile.php.
References array().
Referenced by getProps().
FSFile::getMimeType | ( | ) |
Guess the MIME type from the file contents alone.
Reimplemented in MockFSFile.
Definition at line 91 of file FSFile.php.
Referenced by getProps().
FSFile::getPath | ( | ) |
Returns the file system path.
Definition at line 48 of file FSFile.php.
References $path.
FSFile::getProps | ( | $ext = true | ) |
Get an associative array containing information about a file with the given storage path.
mixed | $ext | The file extension, or true to extract it from the filename. Set it to false to ignore the extension. |
Reimplemented in MockFSFile.
Definition at line 104 of file FSFile.php.
References $ext, array(), exists(), extensionFromPath(), extractImageSizeInfo(), MediaHandler\getHandler(), getMimeType(), getSha1Base36(), getSize(), list, object, placeholderProps(), File\splitMime(), wfDebug(), wfProfileIn(), and wfProfileOut().
Referenced by File\getPropsFromPath().
|
static |
Get an associative array containing information about a file in the local filesystem.
string | $path | absolute local filesystem path |
mixed | $ext | The file extension, or true to extract it from the filename. Set it to false to ignore the extension. |
Definition at line 243 of file FSFile.php.
Referenced by FileBackendTest\doTestStore(), RepoGroup\getFileProps(), UploadStash\stashFile(), LocalFile\upload(), UploadBase\verifyFile(), and UploadBase\verifyPartialFile().
FSFile::getSha1Base36 | ( | $recache = false | ) |
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.
bool | $recache |
Reimplemented in MockFSFile.
Definition at line 201 of file FSFile.php.
References $sha1Base36, wfBaseConvert(), wfProfileIn(), wfProfileOut(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by getProps(), and File\sha1Base36().
|
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.
string | $path |
Definition at line 259 of file FSFile.php.
References $path.
Referenced by ApiTestCaseUpload\deleteFileByContent(), and UploadBase\getTempFileSha1Base36().
FSFile::getSize | ( | ) |
Get the file size in bytes.
Reimplemented in MockFSFile.
Definition at line 66 of file FSFile.php.
Referenced by getProps().
FSFile::getTimestamp | ( | ) |
Get the file's last-modified timestamp.
Reimplemented in MockFSFile.
Definition at line 75 of file FSFile.php.
References $timestamp, TS_MW, wfRestoreWarnings(), wfSuppressWarnings(), and wfTimestamp().
|
static |
Placeholder file properties to use for files that don't exist.
Definition at line 157 of file FSFile.php.
References array(), and MEDIATYPE_UNKNOWN.
Referenced by FileBackendStore\getFileProps(), and getProps().
|
protected |
Path to file *.
Definition at line 30 of file FSFile.php.
Referenced by __construct(), extensionFromPath(), TempFSFile\factory(), getPath(), getPropsFromPath(), and getSha1Base36FromPath().
|
protected |