MediaWiki
REL1_24
|
Web access for files temporarily stored by UploadStash. More...
Public Member Functions | |
__construct () | |
execute ($subPage) | |
Execute page -- can output a file directly or show a listing of them. | |
showUpload ($key) | |
If file available in stash, cats it out to the client as a simple HTTP response. | |
Static Public Member Functions | |
static | tryClearStashedUploads ($formData) |
Static callback for the HTMLForm in showUploads, to process Note the stash has to be recreated since this is being called in a static context. | |
Public Attributes | |
const | MAX_SERVE_BYTES = 1048576 |
Private Member Functions | |
outputContents ($content, $contentType) | |
Output HTTP response of raw content Side effect: writes HTTP response to STDOUT. | |
outputLocalFile (File $file) | |
Output HTTP response for file Side effect: writes HTTP response to STDOUT. | |
outputLocallyScaledThumb ($file, $params, $flags) | |
Scale a file (probably with a locally installed imagemagick, or similar) and output it to STDOUT. | |
outputRemoteScaledThumb ($file, $params, $flags) | |
Scale a file with a remote "scaler", as exists on the Wikimedia Foundation cluster, and output it to STDOUT. | |
outputThumbFromStash ($file, $params) | |
Get a thumbnail for file, either generated locally or remotely, and stream it out. | |
parseKey ($key) | |
Parse the key passed to the SpecialPage. | |
showUploads () | |
Default action when we don't have a subpage -- just show links to the uploads we have, Also show a button to clear stashed files. | |
Static Private Member Functions | |
static | outputFileHeaders ($contentType, $size) |
Output headers for streaming. | |
Private Attributes | |
$stash |
Web access for files temporarily stored by UploadStash.
For example -- files that were uploaded with the UploadWizard extension are stored temporarily before committing them to the db. But we want to see their thumbnails and get other information about them.
Since this is based on the user's session, in effect this creates a private temporary file area. However, the URLs for the files cannot be shared.
Definition at line 35 of file SpecialUploadStash.php.
Definition at line 49 of file SpecialUploadStash.php.
References $e, and RepoGroup\singleton().
SpecialUploadStash::execute | ( | $ | subPage | ) |
Execute page -- can output a file directly or show a listing of them.
string | $subPage | Subpage, e.g. in http://example.com/wiki/Special:UploadStash/foo.jpg, the "foo.jpg" part |
Reimplemented from SpecialPage.
Definition at line 64 of file SpecialUploadStash.php.
References SpecialPage\checkPermissions(), showUpload(), and showUploads().
SpecialUploadStash::outputContents | ( | $ | content, |
$ | contentType | ||
) | [private] |
Output HTTP response of raw content Side effect: writes HTTP response to STDOUT.
string | $content | Content |
string | $contentType | MIME type |
SpecialUploadStashTooLargeException |
Definition at line 299 of file SpecialUploadStash.php.
References $content, $size, outputFileHeaders(), and print.
Referenced by outputRemoteScaledThumb().
static SpecialUploadStash::outputFileHeaders | ( | $ | contentType, |
$ | size | ||
) | [static, private] |
Output headers for streaming.
Side effect: preps PHP to write headers to STDOUT.
string | $contentType | String suitable for content-type header |
string | $size | Length in bytes |
Definition at line 319 of file SpecialUploadStash.php.
Referenced by outputContents().
SpecialUploadStash::outputLocalFile | ( | File $ | file | ) | [private] |
Output HTTP response for file Side effect: writes HTTP response to STDOUT.
File | $file | File object with a local path (e.g. UnregisteredLocalFile, LocalFile. Oddly these don't share an ancestor!) |
SpecialUploadStashTooLargeException |
Definition at line 280 of file SpecialUploadStash.php.
References array(), File\getPath(), File\getRepo(), File\getSize(), and MAX_SERVE_BYTES.
Referenced by outputLocallyScaledThumb(), and showUpload().
SpecialUploadStash::outputLocallyScaledThumb | ( | $ | file, |
$ | params, | ||
$ | flags | ||
) | [private] |
Scale a file (probably with a locally installed imagemagick, or similar) and output it to STDOUT.
File | $file | |
array | $params | Scaling parameters ( e.g. array( width => '50' ) ); |
int | $flags | Scaling flags ( see File:: constants ) |
MWException|UploadStashFileNotFoundException |
Definition at line 184 of file SpecialUploadStash.php.
References $file, $flags, $params, false, outputLocalFile(), and File\RENDER_NOW.
Referenced by outputThumbFromStash().
SpecialUploadStash::outputRemoteScaledThumb | ( | $ | file, |
$ | params, | ||
$ | flags | ||
) | [private] |
Scale a file with a remote "scaler", as exists on the Wikimedia Foundation cluster, and output it to STDOUT.
Note: Unlike the usual thumbnail process, the web client never sees the cluster URL; we do the whole HTTP transaction to the scaler ourselves and cat the results out. Note: We rely on NFS to have propagated the file contents to the scaler. However, we do not rely on the thumbnail being created in NFS and then propagated back to our filesystem. Instead we take the results of the HTTP request instead. Note: No caching is being done here, although we are instructing the client to cache it forever.
File | $file | |
array | $params | Scaling parameters ( e.g. array( width => '50' ) ); |
int | $flags | Scaling flags ( see File:: constants ) |
MWException |
Definition at line 230 of file SpecialUploadStash.php.
References $file, $params, array(), MWHttpRequest\factory(), SpecialPage\getConfig(), outputContents(), and wfExpandUrl().
Referenced by outputThumbFromStash().
SpecialUploadStash::outputThumbFromStash | ( | $ | file, |
$ | params | ||
) | [private] |
Get a thumbnail for file, either generated locally or remotely, and stream it out.
File | $file | |
array | $params |
Definition at line 161 of file SpecialUploadStash.php.
References $file, $flags, $params, SpecialPage\getConfig(), outputLocallyScaledThumb(), and outputRemoteScaledThumb().
Referenced by showUpload().
SpecialUploadStash::parseKey | ( | $ | key | ) | [private] |
Parse the key passed to the SpecialPage.
Returns an array containing the associated file object, the type ('file' or 'thumb') and if application the transform parameters
string | $key |
UploadStashBadPathException |
Definition at line 123 of file SpecialUploadStash.php.
References $file, $key, $params, $type, and array().
Referenced by showUpload().
SpecialUploadStash::showUpload | ( | $ | key | ) |
If file available in stash, cats it out to the client as a simple HTTP response.
n.b. Most sanity checking done in UploadStashLocalFile, so this is straightforward.
string | $key | The key of a particular requested file |
HttpError |
Definition at line 82 of file SpecialUploadStash.php.
References $e, $key, $params, SpecialPage\getOutput(), outputLocalFile(), outputThumbFromStash(), and parseKey().
Referenced by execute().
SpecialUploadStash::showUploads | ( | ) | [private] |
Default action when we don't have a subpage -- just show links to the uploads we have, Also show a button to clear stashed files.
Definition at line 354 of file SpecialUploadStash.php.
References $file, $files, $form, array(), as, Html\element(), SpecialPage\getContext(), SpecialPage\getOutput(), SpecialPage\getPageTitle(), SpecialPage\msg(), SpecialPage\outputHeader(), Html\rawElement(), SpecialPage\setHeaders(), and text.
Referenced by execute().
static SpecialUploadStash::tryClearStashedUploads | ( | $ | formData | ) | [static] |
Static callback for the HTMLForm in showUploads, to process Note the stash has to be recreated since this is being called in a static context.
This works, because there really is only one stash per logged-in user, despite appearances.
array | $formData |
Definition at line 336 of file SpecialUploadStash.php.
References $stash, Status\newFatal(), Status\newGood(), RepoGroup\singleton(), true, and wfDebug().
SpecialUploadStash::$stash [private] |
Definition at line 37 of file SpecialUploadStash.php.
Referenced by tryClearStashedUploads().
const SpecialUploadStash::MAX_SERVE_BYTES = 1048576 |
Definition at line 47 of file SpecialUploadStash.php.
Referenced by outputLocalFile().