[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Source view] [Print] [Project Stats]
Temporary storage for uploaded files. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
File Size: | 752 lines (24 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
UploadStash:: (12 methods):
__construct()
getFile()
getMetadata()
getFileProps()
stashFile()
clear()
removeFile()
removeFileNoAuth()
listFiles()
getExtensionForPath()
fetchFileMetadata()
initFile()
UploadStashFile:: (12 methods):
__construct()
getDescriptionUrl()
getThumbPath()
thumbName()
getSpecialUrl()
getThumbUrl()
getUrlName()
getUrl()
getFullUrl()
getFileKey()
remove()
exists()
UploadStashException:: (0 methods):
UploadStashNotAvailableException:: (0 methods):
UploadStashFileNotFoundException:: (0 methods):
UploadStashBadPathException:: (0 methods):
UploadStashFileException:: (0 methods):
UploadStashZeroLengthFileException:: (0 methods):
UploadStashNotLoggedInException:: (0 methods):
UploadStashWrongOwnerException:: (0 methods):
UploadStashNoSuchKeyException:: (0 methods):
Class: UploadStash - X-Ref
UploadStash is intended to accomplish a few things:__construct( FileRepo $repo, $user = null ) X-Ref |
Represents a temporary filestore, with metadata in the database. Designed to be compatible with the session stashing code in UploadBase (should replace it eventually). param: FileRepo $repo param: User $user (default null) |
getFile( $key, $noAuth = false ) X-Ref |
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. param: string $key Key under which file information is stored param: bool $noAuth (optional) Don't check authentication. Used by maintenance scripts. return: UploadStashFile |
getMetadata( $key ) X-Ref |
Getter for file metadata. param: string $key Key under which file information is stored return: array |
getFileProps( $key ) X-Ref |
Getter for fileProps param: string $key Key under which file information is stored return: array |
stashFile( $path, $sourceType = null ) X-Ref |
Stash a file in a temp directory and record that we did this in the database, along with other metadata. param: string $path Path to file you want stashed param: string $sourceType The type of upload that generated this file return: UploadStashFile|null File, or null on failure |
clear() X-Ref |
Remove all files from the stash. Does not clean up files in the repo, just the record of them. return: bool Success |
removeFile( $key ) X-Ref |
Remove a particular file from the stash. Also removes it from the repo. param: string $key return: bool Success |
removeFileNoAuth( $key ) X-Ref |
Remove a file (see removeFile), but doesn't check ownership first. param: string $key return: bool Success |
listFiles() X-Ref |
List all files in the stash. return: array |
getExtensionForPath( $path ) X-Ref |
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... param: string $path return: string |
fetchFileMetadata( $key, $readFromDB = DB_SLAVE ) X-Ref |
Helper function: do the actual database query to fetch file metadata. param: string $key param: int $readFromDB Constant (default: DB_SLAVE) return: bool |
initFile( $key ) X-Ref |
Helper function: Initialize the UploadStashFile for a given file. param: string $key Key under which to store the object return: bool |
Class: UploadStashFile - X-Ref
__construct( $repo, $path, $key ) X-Ref |
A LocalFile wrapper around a file that has been temporarily stashed, so we can do things like create thumbnails for it. Arguably UnregisteredLocalFile should be handling its own file repo but that class is a bit retarded currently. param: FileRepo $repo Repository where we should find the path param: string $path Path to file param: string $key Key to store the path and any stashed data under |
getDescriptionUrl() X-Ref |
A method needed by the file transforming and scaling routines in File.php We do not necessarily care about doing the description at this point However, we also can't return the empty string, as the rest of MediaWiki demands this (and calls to imagemagick convert require it to be there) return: string Dummy value |
getThumbPath( $thumbName = false ) X-Ref |
Get the path for the thumbnail (actually any transformation of this file) The actual argument is the result of thumbName although we seem to have buggy code elsewhere that expects a boolean 'suffix' param: string $thumbName Name of thumbnail (e.g. "120px-123456.jpg" ), return: string Path thumbnail should take on filesystem, or containing |
thumbName( $params, $flags = 0 ) X-Ref |
Return the file/url base name of a thumbnail with the specified parameters. We override this because we want to use the pretty url name instead of the ugly file name. param: array $params Handler-specific parameters param: int $flags Bitfield that supports THUMB_* constants return: string Base name for URL, like '120px-12345.jpg', or null if there is no handler |
getSpecialUrl( $subPage ) X-Ref |
Helper function -- given a 'subpage', return the local URL, e.g. /wiki/Special:UploadStash/subpage param: string $subPage return: string Local URL for this subpage in the Special:UploadStash space. |
getThumbUrl( $thumbName = false ) X-Ref |
Get a URL to access the thumbnail This is required because the model of how files work requires that the thumbnail urls be predictable. However, in our model the URL is not based on the filename (that's hidden in the db) param: string $thumbName Basename of thumbnail file -- however, we don't return: string URL to access thumbnail, or URL with partial path |
getUrlName() X-Ref |
The basename for the URL, which we want to not be related to the filename. Will also be used as the lookup key for a thumbnail file. return: string Base url name, like '120px-123456.jpg' |
getUrl() X-Ref |
Return the URL of the file, if for some reason we wanted to download it We tend not to do this for the original file, but we do want thumb icons return: string Url |
getFullUrl() X-Ref |
Parent classes use this method, for no obvious reason, to return the path (relative to wiki root, I assume). But with this class, the URL is unrelated to the path. return: string Url |
getFileKey() X-Ref |
Getter for file key (the unique id by which this file's location & metadata is stored in the db) return: string File key |
remove() X-Ref |
Remove the associated temporary file return: status Success |
exists() X-Ref |
No description |
Class: UploadStashException - X-Ref
Class: UploadStashNotAvailableException - X-Ref
Class: UploadStashFileNotFoundException - X-Ref
Class: UploadStashBadPathException - X-Ref
Class: UploadStashFileException - X-Ref
Class: UploadStashZeroLengthFileException - X-Ref
Class: UploadStashNotLoggedInException - X-Ref
Class: UploadStashWrongOwnerException - X-Ref
Class: UploadStashNoSuchKeyException - X-Ref
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |