[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/specials/ -> SpecialUploadStash.php (summary)

Implements Special:UploadStash. 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: 408 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

SpecialUploadStash:: (12 methods):
  __construct()
  execute()
  showUpload()
  parseKey()
  outputThumbFromStash()
  outputLocallyScaledThumb()
  outputRemoteScaledThumb()
  outputLocalFile()
  outputContents()
  outputFileHeaders()
  tryClearStashedUploads()
  showUploads()

SpecialUploadStashTooLargeException:: (0 methods):


Class: SpecialUploadStash  - X-Ref

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.
__construct()   X-Ref
No description

execute( $subPage )   X-Ref
Execute page -- can output a file directly or show a listing of them.

param: string $subPage Subpage, e.g. in
return: bool Success

showUpload( $key )   X-Ref
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.

param: string $key The key of a particular requested file
return: bool

parseKey( $key )   X-Ref
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

param: string $key
return: array

outputThumbFromStash( $file, $params )   X-Ref
Get a thumbnail for file, either generated locally or remotely, and stream it out

param: File $file
param: array $params
return: bool Success

outputLocallyScaledThumb( $file, $params, $flags )   X-Ref
Scale a file (probably with a locally installed imagemagick, or similar)
and output it to STDOUT.

param: File $file
param: array $params Scaling parameters ( e.g. array( width => '50' ) );
param: int $flags Scaling flags ( see File:: constants )
return: bool Success

outputRemoteScaledThumb( $file, $params, $flags )   X-Ref
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.

param: File $file
param: array $params Scaling parameters ( e.g. array( width => '50' ) );
param: int $flags Scaling flags ( see File:: constants )
return: bool Success

outputLocalFile( File $file )   X-Ref
Output HTTP response for file
Side effect: writes HTTP response to STDOUT.

param: File $file File object with a local path (e.g. UnregisteredLocalFile,
return: bool

outputContents( $content, $contentType )   X-Ref
Output HTTP response of raw content
Side effect: writes HTTP response to STDOUT.

param: string $content Content
param: string $contentType MIME type
return: bool

outputFileHeaders( $contentType, $size )   X-Ref
Output headers for streaming

param: string $contentType String suitable for content-type header
param: string $size Length in bytes

tryClearStashedUploads( $formData )   X-Ref
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.

param: array $formData
return: Status

showUploads()   X-Ref
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

return: bool

Class: SpecialUploadStashTooLargeException  - X-Ref



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1