Go to the documentation of this file.
50 parent::__construct(
'UploadStash',
'upload' );
67 if ( $subPage ===
null || $subPage ===
'' ) {
88 if (
$params[
'type'] ===
'thumb' ) {
95 $message =
$e->getMessage();
98 $message =
$e->getMessage();
101 $message =
$e->getMessage();
104 $message =
'Cannot serve a file larger than ' . self::MAX_SERVE_BYTES .
105 ' bytes. ' .
$e->getMessage();
106 }
catch ( Exception
$e ) {
108 $message =
$e->getMessage();
124 $type = strtok( $key,
'/' );
126 if (
$type !==
'file' &&
$type !==
'thumb' ) {
129 $fileName = strtok(
'/' );
130 $thumbPart = strtok(
'/' );
131 $file = $this->stash->getFile( $fileName );
132 if (
$type ===
'thumb' ) {
133 $srcNamePos = strrpos( $thumbPart, $fileName );
134 if ( $srcNamePos ===
false || $srcNamePos < 1 ) {
137 $paramString = substr( $thumbPart, 0, $srcNamePos - 1 );
139 $handler =
$file->getHandler();
141 $params = $handler->parseParamString( $paramString );
146 "mime {$file->getMimeType()} of file {$file->getPath()}" );
167 global $wgUploadStashScalerBaseUrl;
170 if ( $wgUploadStashScalerBaseUrl ) {
193 if ( !$thumbnailImage ) {
194 throw new MWException(
'Could not obtain thumbnail' );
198 if ( !$thumbnailImage->getStoragePath() ) {
205 $this->stash->repo, $thumbnailImage->getStoragePath(),
false );
236 global $wgUploadStashScalerBaseUrl;
237 $scalerBaseUrl = $wgUploadStashScalerBaseUrl;
239 if ( preg_match(
'/^\/\//', $scalerBaseUrl ) ) {
250 $scalerThumbUrl = $scalerBaseUrl .
'/' .
$file->getUrlRel() .
251 '/' . rawurlencode( $scalerThumbName );
254 $httpOptions =
array(
256 'timeout' =>
'default'
259 $status = $req->execute();
260 if ( !$status->isOK() ) {
261 $errors = $status->getErrorsArray();
262 $errorStr =
"Fetching thumbnail failed: " . print_r( $errors, 1 );
263 $errorStr .=
"\nurl = $scalerThumbUrl\n";
266 $contentType = $req->getResponseHeader(
"content-type" );
267 if ( !$contentType ) {
268 throw new MWException(
"Missing content-type header" );
288 return $file->getRepo()->streamFile(
$file->getPath(),
289 array(
'Content-Transfer-Encoding: binary',
290 'Expires: Sun, 17-Jan-2038 19:14:07 GMT' )
303 $size = strlen( $content );
304 if (
$size > self::MAX_SERVE_BYTES ) {
323 header(
"Content-Type: $contentType",
true );
324 header(
'Content-Transfer-Encoding: binary',
true );
325 header(
'Expires: Sun, 17-Jan-2038 19:14:07 GMT',
true );
327 header(
'Cache-Control: private' );
328 header(
"Content-Length: $size",
true );
340 if ( isset( $formData[
'Clear'] ) ) {
373 ), $context,
'clearStashedUploads' );
374 $form->setSubmitCallback(
array( __CLASS__,
'tryClearStashedUploads' ) );
375 $form->setSubmitTextMsg(
'uploadstash-clear' );
377 $form->prepareForm();
378 $formResult =
$form->tryAuthorizedSubmit();
383 $this->
msg(
'uploadstash-refresh' )->
text() );
384 $files = $this->stash->listFiles();
387 $fileListItemsHtml =
'';
396 $form->displayForm( $formResult );
getPageTitle( $subpage=false)
Get a self-referential title object.
static tryClearStashedUploads( $formData)
Static callback for the HTMLForm in showUploads, to process Note the stash has to be recreated since ...
static singleton()
Get a RepoGroup instance.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
getOutput()
Get the OutputPage being used for this instance.
Shortcut to construct a special page which is unlisted by default.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead $form
A file object referring to either a standalone local file, or a file in a local repository with no da...
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
static newGood( $value=null)
Factory function for good results.
outputRemoteScaledThumb( $file, $params, $flags)
Scale a file with a remote "scaler", as exists on the Wikimedia Foundation cluster,...
execute( $subPage)
Execute page – can output a file directly or show a listing of them.
it s the revision text itself In either if gzip is the revision text is gzipped $flags
outputLocalFile(File $file)
Output HTTP response for file Side effect: writes HTTP response to STDOUT.
Show an error that looks like an HTTP server error.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
An IContextSource implementation which will inherit context from another source but allow individual ...
Implements some public methods and some protected utility functions which are required by multiple ch...
Web access for files temporarily stored by UploadStash.
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
parseKey( $key)
Parse the key passed to the SpecialPage.
static outputFileHeaders( $contentType, $size)
Output headers for streaming.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
when a variable name is used in a it is silently declared as a new masking the global
processing should stop and the error should be shown to the user * false
getContext()
Gets the context this SpecialPage is executed in.
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
msg()
Wrapper around wfMessage that sets the current context.
outputLocallyScaledThumb( $file, $params, $flags)
Scale a file (probably with a locally installed imagemagick, or similar) and output it to STDOUT.
showUploads()
Default action when we don't have a subpage – just show links to the uploads we have,...
if(PHP_SAPI !='cli') $file
const RENDER_NOW
Force rendering in the current process.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
outputThumbFromStash( $file, $params)
Get a thumbnail for file, either generated locally or remotely, and stream it out.
outputContents( $content, $contentType)
Output HTTP response of raw content Side effect: writes HTTP response to STDOUT.
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
static factory( $url, $options=null)
Generate a new request object.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
showUpload( $key)
If file available in stash, cats it out to the client as a simple HTTP response.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
static newFatal( $message)
Factory function for fatal errors.