MediaWiki
REL1_19
|
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 ($status=null) | |
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 XXX unsure about encoding as binary; if we received from HTTP perhaps we should use that encoding, concatted with semicolon to mimeType as it usually is. | |
Private Attributes | |
$stash |
Definition at line 19 of file SpecialUploadStash.php.
Definition at line 33 of file SpecialUploadStash.php.
References RepoGroup\singleton().
SpecialUploadStash::execute | ( | $ | subPage | ) |
Execute page -- can output a file directly or show a listing of them.
$subPage | String: subpage, e.g. in http://example.com/wiki/Special:UploadStash/foo.jpg, the "foo.jpg" part |
Reimplemented from SpecialPage.
Definition at line 47 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 | $mimeType,: | mime type |
Definition at line 261 of file SpecialUploadStash.php.
References $size, outputFileHeaders(), and print.
Referenced by outputRemoteScaledThumb().
static SpecialUploadStash::outputFileHeaders | ( | $ | contentType, |
$ | size | ||
) | [static, private] |
Output headers for streaming XXX unsure about encoding as binary; if we received from HTTP perhaps we should use that encoding, concatted with semicolon to mimeType as it usually is.
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 278 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 object with a local path (e.g. UnregisteredLocalFile, LocalFile. Oddly these don't share an ancestor!) |
Definition at line 245 of file SpecialUploadStash.php.
References 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 object |
$params,: | scaling parameters ( e.g. array( width => '50' ) ); |
$flags,: | scaling flags ( see File:: constants ) |
MWException |
Definition at line 156 of file SpecialUploadStash.php.
References $file, 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 object |
$params,: | scaling parameters ( e.g. array( width => '50' ) ); |
$flags,: | scaling flags ( see File:: constants ) |
MWException |
Definition at line 198 of file SpecialUploadStash.php.
References $file, $wgUploadStashScalerBaseUrl, MWHttpRequest\factory(), 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 | |
$params | array |
Definition at line 133 of file SpecialUploadStash.php.
References $file, $wgUploadStashScalerBaseUrl, 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 |
Definition at line 101 of file SpecialUploadStash.php.
References $file.
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.
$key | String: the key of a particular requested file |
Definition at line 62 of file SpecialUploadStash.php.
References SpecialPage\getOutput(), outputLocalFile(), outputThumbFromStash(), and parseKey().
Referenced by execute().
SpecialUploadStash::showUploads | ( | $ | status = null | ) | [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.
Status | : $status - the result of processRequest |
Definition at line 310 of file SpecialUploadStash.php.
References $file, $files, Html\element(), SpecialPage\getContext(), SpecialPage\getOutput(), SpecialPage\getTitle(), Status\newGood(), SpecialPage\outputHeader(), Html\rawElement(), SpecialPage\setHeaders(), and wfMsg().
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.
Definition at line 294 of file SpecialUploadStash.php.
References $stash, Status\newFatal(), Status\newGood(), RepoGroup\singleton(), and wfDebug().
SpecialUploadStash::$stash [private] |
Definition at line 21 of file SpecialUploadStash.php.
Referenced by tryClearStashedUploads().
const SpecialUploadStash::MAX_SERVE_BYTES = 1048576 |
Definition at line 31 of file SpecialUploadStash.php.
Referenced by outputLocalFile().