MediaWiki master
|
This class is used to hold the location and do limited manipulation of files stored temporarily (this will be whatever wfTempDir() returns) More...
Inherits Wikimedia\FileBackend\FSFile\FSFile.
Public Member Functions | |
__construct ( $path) | |
Do not call directly. | |
__destruct () | |
Cleans up after the temporary file by deleting it. | |
autocollect () | |
Set flag clean up after the temporary file. | |
bind ( $object) | |
Clean up the temporary file only after an object goes out of scope. | |
preserve () | |
Set flag to not clean up after the temporary file. | |
purge () | |
Purge this file off the file system. | |
![]() | |
exists () | |
Checks if the file exists. | |
getPath () | |
Returns the file system path. | |
getProps ( $ext=true) | |
Get an associative array containing information about a file with the given storage path. | |
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. | |
getSize () | |
Get the file size in bytes. | |
getTimestamp () | |
Get the file's last-modified timestamp. | |
Static Public Member Functions | |
static | factory ( $prefix, $extension='', $tmpDirectory=null) |
Make a new temporary file on the file system. | |
static | getUsableTempDirectory () |
static | purgeAllOnShutdown () |
Try to make sure that all files are purged on error. | |
![]() | |
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 Attributes | |
bool | $canDelete = false |
Garbage collect the temp file. | |
![]() | |
string | $path |
Path to file. | |
string | $sha1Base36 |
File SHA-1 in base 36. | |
Static Protected Attributes | |
static array | $pathsCollect = null |
Map of (path => 1) for paths to delete on shutdown. | |
This class is used to hold the location and do limited manipulation of files stored temporarily (this will be whatever wfTempDir() returns)
Definition at line 37 of file TempFSFile.php.
Wikimedia\FileBackend\FSFile\TempFSFile::__construct | ( | $path | ) |
Do not call directly.
Use TempFSFileFactory
string | $path |
Reimplemented from Wikimedia\FileBackend\FSFile\FSFile.
Definition at line 57 of file TempFSFile.php.
References Wikimedia\FileBackend\FSFile\FSFile\$path.
Wikimedia\FileBackend\FSFile\TempFSFile::__destruct | ( | ) |
Cleans up after the temporary file by deleting it.
Definition at line 207 of file TempFSFile.php.
References Wikimedia\FileBackend\FSFile\TempFSFile\purge().
Wikimedia\FileBackend\FSFile\TempFSFile::autocollect | ( | ) |
Set flag clean up after the temporary file.
Definition at line 181 of file TempFSFile.php.
References Wikimedia\FileBackend\FSFile\FSFile\$path.
Wikimedia\FileBackend\FSFile\TempFSFile::bind | ( | $object | ) |
Clean up the temporary file only after an object goes out of scope.
mixed | $object |
Definition at line 142 of file TempFSFile.php.
|
static |
Make a new temporary file on the file system.
Temporary files may be purged when the file object falls out of scope.
string | $prefix | |
string | $extension | Optional file extension |
string | null | $tmpDirectory | Optional parent directory |
Definition at line 79 of file TempFSFile.php.
|
static |
RuntimeException | if no writable temporary directory can be found |
Definition at line 90 of file TempFSFile.php.
Referenced by Wikimedia\FileBackend\FSFile\TempFSFileFactory\newTempFSFile().
Wikimedia\FileBackend\FSFile\TempFSFile::preserve | ( | ) |
Set flag to not clean up after the temporary file.
Definition at line 168 of file TempFSFile.php.
Wikimedia\FileBackend\FSFile\TempFSFile::purge | ( | ) |
Purge this file off the file system.
Definition at line 125 of file TempFSFile.php.
Referenced by Wikimedia\FileBackend\FSFile\TempFSFile\__destruct().
|
static |
Try to make sure that all files are purged on error.
This method should only be called internally
Definition at line 196 of file TempFSFile.php.
References Wikimedia\FileBackend\FSFile\FSFile\$path.
|
protected |
Garbage collect the temp file.
Definition at line 39 of file TempFSFile.php.
|
staticprotected |
Map of (path => 1) for paths to delete on shutdown.
Definition at line 42 of file TempFSFile.php.