MediaWiki  REL1_19
SpecialUploadStash Class Reference
Inheritance diagram for SpecialUploadStash:
Collaboration diagram for SpecialUploadStash:

List of all members.

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

Detailed Description

Definition at line 19 of file SpecialUploadStash.php.


Constructor & Destructor Documentation

Definition at line 33 of file SpecialUploadStash.php.

References RepoGroup\singleton().

Here is the call graph for this function:


Member Function Documentation

Execute page -- can output a file directly or show a listing of them.

Parameters:
$subPageString: subpage, e.g. in http://example.com/wiki/Special:UploadStash/foo.jpg, the "foo.jpg" part
Returns:
Boolean: success

Reimplemented from SpecialPage.

Definition at line 47 of file SpecialUploadStash.php.

References SpecialPage\checkPermissions(), showUpload(), and showUploads().

Here is the call graph for this function:

SpecialUploadStash::outputContents ( content,
contentType 
) [private]

Output HTTP response of raw content Side effect: writes HTTP response to STDOUT.

Parameters:
String$content,:content
String$mimeType,:mime type

Definition at line 261 of file SpecialUploadStash.php.

References $size, outputFileHeaders(), and print.

Referenced by outputRemoteScaledThumb().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
String$contentType: string suitable for content-type header
String$size,:length in bytes

Definition at line 278 of file SpecialUploadStash.php.

Referenced by outputContents().

Here is the caller graph for this function:

Output HTTP response for file Side effect: writes HTTP response to STDOUT.

Parameters:
$fileFile 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().

Here is the call graph for this function:

Here is the caller graph for this function:

SpecialUploadStash::outputLocallyScaledThumb ( file,
params,
flags 
) [private]

Scale a file (probably with a locally installed imagemagick, or similar) and output it to STDOUT.

Parameters:
$file,:File object
$params,:scaling parameters ( e.g. array( width => '50' ) );
$flags,:scaling flags ( see File:: constants )
Exceptions:
MWException
Returns:
boolean success

Definition at line 156 of file SpecialUploadStash.php.

References $file, false, outputLocalFile(), and File\RENDER_NOW.

Referenced by outputThumbFromStash().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
$file,:File object
$params,:scaling parameters ( e.g. array( width => '50' ) );
$flags,:scaling flags ( see File:: constants )
Exceptions:
MWException
Returns:
boolean success

Definition at line 198 of file SpecialUploadStash.php.

References $file, $wgUploadStashScalerBaseUrl, MWHttpRequest\factory(), outputContents(), and wfExpandUrl().

Referenced by outputThumbFromStash().

Here is the call graph for this function:

Here is the caller graph for this function:

SpecialUploadStash::outputThumbFromStash ( file,
params 
) [private]

Get a thumbnail for file, either generated locally or remotely, and stream it out.

Parameters:
$file
$paramsarray
Returns:
boolean success

Definition at line 133 of file SpecialUploadStash.php.

References $file, $wgUploadStashScalerBaseUrl, outputLocallyScaledThumb(), and outputRemoteScaledThumb().

Referenced by showUpload().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
string$key
Returns:
array

Definition at line 101 of file SpecialUploadStash.php.

References $file.

Referenced by showUpload().

Here is the caller graph for this function:

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.

Parameters:
$keyString: 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Returns:
Status

Definition at line 294 of file SpecialUploadStash.php.

References $stash, Status\newFatal(), Status\newGood(), RepoGroup\singleton(), and wfDebug().

Here is the call graph for this function:


Member Data Documentation

SpecialUploadStash::$stash [private]

Definition at line 21 of file SpecialUploadStash.php.

Referenced by tryClearStashedUploads().

Definition at line 31 of file SpecialUploadStash.php.

Referenced by outputLocalFile().


The documentation for this class was generated from the following file: