MediaWiki
REL1_19
|
UploadStash is intended to accomplish a few things: More...
Public Member Functions | |
__construct (FileRepo $repo, $user=null) | |
Represents a temporary filestore, with metadata in the database. | |
clear () | |
Remove all files from the stash. | |
getFile ($key, $noAuth=false) | |
Get a file and its metadata from the stash. | |
getFileProps ($key) | |
Getter for fileProps. | |
getMetadata ($key) | |
Getter for file metadata. | |
listFiles () | |
List all files in the stash. | |
removeFile ($key) | |
Remove a particular file from the stash. | |
removeFileNoAuth ($key) | |
Remove a file (see removeFile), but doesn't check ownership first. | |
stashFile ($path, $sourceType=null) | |
Stash a file in a temp directory and record that we did this in the database, along with other metadata. | |
Static Public Member Functions | |
static | getExtensionForPath ($path) |
Find or guess extension -- ensuring that our extension matches our mime type. | |
Public Attributes | |
$isLoggedIn | |
$repo | |
$userId | |
const | KEY_FORMAT_REGEX = '/^[\w-\.]+\.\w*$/' |
Protected Member Functions | |
fetchFileMetadata ($key, $readFromDB=DB_SLAVE) | |
Helper function: do the actual database query to fetch file metadata. | |
initFile ($key) | |
Helper function: Initialize the UploadStashFile for a given file. | |
Protected Attributes | |
$fileMetadata = array() | |
$fileProps = array() | |
$files = array() | |
$user |
UploadStash is intended to accomplish a few things:
UploadStash right now is *mostly* intended to show you one user's slice of the entire stash. The user parameter is only optional because there are few cases where we clean out the stash from an automated script. In the future we might refactor this.
UploadStash represents the entire stash of temporary files. UploadStashFile is a filestore for the actual physical disk files. UploadFromStash extends UploadBase, and represents a single stashed file as it is moved from the stash to the regular file repository
Definition at line 22 of file UploadStash.php.
UploadStash::__construct | ( | FileRepo $ | repo, |
$ | user = null |
||
) |
Represents a temporary filestore, with metadata in the database.
Designed to be compatible with the session stashing code in UploadBase (should replace it eventually)
$repo | FileRepo |
Definition at line 53 of file UploadStash.php.
Remove all files from the stash.
Does not clean up files in the repo, just the record of them.
UploadStashNotLoggedInException |
Definition at line 271 of file UploadStash.php.
References wfDebug().
UploadStash::fetchFileMetadata | ( | $ | key, |
$ | readFromDB = DB_SLAVE |
||
) | [protected] |
Helper function: do the actual database query to fetch file metadata.
$key | String: key |
Definition at line 433 of file UploadStash.php.
References $dbr.
Referenced by getFile().
static UploadStash::getExtensionForPath | ( | $ | path | ) | [static] |
Find or guess extension -- ensuring that our extension matches our mime type.
Since these files are constructed from php tempnames they may not start off with an extension. XXX this is somewhat redundant with the checks that ApiUpload.php does with incoming uploads versus the desired filename. Maybe we can get that passed to us...
Definition at line 395 of file UploadStash.php.
References $extensions, $n, $path, $wgFileBlacklist, File\normalizeExtension(), and MimeMagic\singleton().
Referenced by stashFile().
UploadStash::getFile | ( | $ | key, |
$ | noAuth = false |
||
) |
Get a file and its metadata from the stash.
The noAuth param is a bit janky but is required for automated scripts which clean out the stash.
$key | String: key under which file information is stored |
$noAuth | Boolean (optional) Don't check authentication. Used by maintenance scripts. |
UploadStashFileNotFoundException | |
UploadStashNotLoggedInException | |
UploadStashWrongOwnerException | |
UploadStashBadPathException |
Definition at line 84 of file UploadStash.php.
References $path, fetchFileMetadata(), initFile(), and wfDebug().
Referenced by getFileProps(), getMetadata(), and stashFile().
UploadStash::getFileProps | ( | $ | key | ) |
Getter for fileProps.
key | String: key under which file information is stored |
Definition at line 145 of file UploadStash.php.
References getFile().
UploadStash::getMetadata | ( | $ | key | ) |
Getter for file metadata.
key | String: key under which file information is stored |
Definition at line 134 of file UploadStash.php.
References getFile().
UploadStash::initFile | ( | $ | key | ) | [protected] |
Helper function: Initialize the UploadStashFile for a given file.
$path | String: path to file |
$key | String: key under which to store the object |
UploadStashZeroLengthFileException |
Definition at line 468 of file UploadStash.php.
References $file.
Referenced by getFile(), and stashFile().
List all files in the stash.
UploadStashNotLoggedInException |
Definition at line 361 of file UploadStash.php.
UploadStash::removeFile | ( | $ | key | ) |
Remove a particular file from the stash.
Also removes it from the repo.
Definition at line 298 of file UploadStash.php.
References removeFileNoAuth().
UploadStash::removeFileNoAuth | ( | $ | key | ) |
Remove a file (see removeFile), but doesn't check ownership first.
Definition at line 331 of file UploadStash.php.
References wfDebug().
Referenced by removeFile().
UploadStash::stashFile | ( | $ | path, |
$ | sourceType = null |
||
) |
Stash a file in a temp directory and record that we did this in the database, along with other metadata.
$path | String: path to file you want stashed |
$sourceType | String: the type of upload that generated this file (currently, I believe, 'file' or null) |
Definition at line 160 of file UploadStash.php.
References $fileProps, $path, getExtensionForPath(), getFile(), FSFile\getPropsFromPath(), initFile(), wfBaseConvert(), wfDebug(), and wfMessage().
UploadStash::$fileMetadata = array() [protected] |
Definition at line 39 of file UploadStash.php.
UploadStash::$fileProps = array() [protected] |
Definition at line 42 of file UploadStash.php.
Referenced by stashFile().
UploadStash::$files = array() [protected] |
Definition at line 36 of file UploadStash.php.
UploadStash::$isLoggedIn |
Definition at line 45 of file UploadStash.php.
UploadStash::$repo |
Definition at line 33 of file UploadStash.php.
Referenced by __construct().
UploadStash::$user [protected] |
Definition at line 45 of file UploadStash.php.
Referenced by __construct().
UploadStash::$userId |
Definition at line 45 of file UploadStash.php.
const UploadStash::KEY_FORMAT_REGEX = '/^[\w-\.]+\.\w*$/' |
Definition at line 25 of file UploadStash.php.
Referenced by UploadFromStash\isValidKey().