Go to the documentation of this file.
37 global $wgEnableAsyncUploads;
40 if ( !UploadBase::isEnabled() ) {
48 $request = $this->
getMain()->getRequest();
50 $this->mParams[
'async'] = ( $this->mParams[
'async'] && $wgEnableAsyncUploads );
52 $this->mParams[
'file'] = $request->getFileName(
'file' );
53 $this->mParams[
'chunk'] = $request->getFileName(
'chunk' );
56 if ( !$this->mParams[
'filekey'] && $this->mParams[
'sessionkey'] ) {
57 $this->mParams[
'filekey'] = $this->mParams[
'sessionkey'];
64 } elseif ( !isset( $this->mUpload ) ) {
65 $this->
dieUsage(
'No upload module set',
'nomodule' );
68 $this->
dieUsage( get_class(
$e ) .
": " .
$e->getMessage(),
'stasherror' );
76 $status = $this->mUpload->fetchFile();
77 if ( !$status->isGood() ) {
78 $errors = $status->getErrorsArray();
79 $error = array_shift( $errors[0] );
80 $this->
dieUsage(
'Error fetching file from remote source',
$error, 0, $errors[0] );
84 if ( $this->mParams[
'chunk'] ) {
85 $maxSize = UploadBase::getMaxUploadSize();
86 if ( $this->mParams[
'filesize'] > $maxSize ) {
87 $this->
dieUsage(
'The file you submitted was too large',
'file-too-large' );
89 if ( !$this->mUpload->getTitle() ) {
90 $this->
dieUsage(
'Invalid file title supplied',
'internal-error' );
92 } elseif ( $this->mParams[
'async'] && $this->mParams[
'filekey'] ) {
95 wfDebug( __METHOD__ .
" about to verify\n" );
102 if ( !$this->mParams[
'stash'] ) {
103 $permErrors = $this->mUpload->verifyTitlePermissions(
$user );
104 if ( $permErrors !==
true ) {
112 if (
$result[
'result'] ===
'Success' ) {
116 $this->
dieUsage( get_class(
$e ) .
": " .
$e->getMessage(),
'stasherror' );
122 $this->mUpload->cleanupTempFile();
131 if ( $warnings && !$this->mParams[
'ignorewarnings'] ) {
134 } elseif ( $this->mParams[
'chunk'] ) {
137 } elseif ( $this->mParams[
'stash'] ) {
143 if ( UploadBase::isThrottled( $this->
getUser() )
166 if ( $warnings && count( $warnings ) > 0 ) {
167 $result[
'warnings'] = $warnings;
170 $this->
dieUsage( $e->getMessage(),
'stashfailed' );
184 $result[
'warnings'] = $warnings;
191 $result[
'warnings'][
'stashfailed'] =
$e->getMessage();
205 if ( $warnings && count( $warnings ) > 0 ) {
206 $result[
'warnings'] = $warnings;
209 $request = $this->
getMain()->getRequest();
210 $chunkPath = $request->getFileTempname(
'chunk' );
211 $chunkSize = $request->getUpload(
'chunk' )->getSize();
212 $totalSoFar = $this->mParams[
'offset'] + $chunkSize;
213 $minChunkSize = $this->
getConfig()->get(
'MinUploadChunkSize' );
216 if ( $totalSoFar > $this->mParams[
'filesize'] ) {
218 'Offset plus current chunk is greater than claimed file size',
'invalid-chunk'
223 if ( $totalSoFar != $this->mParams[
'filesize'] && $chunkSize < $minChunkSize ) {
225 "Minimum chunk size is $minChunkSize bytes for non-final chunks",
'chunk-too-small'
229 if ( $this->mParams[
'offset'] == 0 ) {
234 $this->
dieUsage( $e->getMessage(),
'stashfailed' );
237 $filekey = $this->mParams[
'filekey'];
240 $progress = UploadBase::getSessionStatus( $this->
getUser(), $filekey );
243 $this->
dieUsage(
'No chunked upload session with this key',
'stashfailed' );
244 } elseif ( $progress[
'result'] !==
'Continue' || $progress[
'stage'] !==
'uploading' ) {
246 'Chunked upload is already completed, check status for details',
'stashfailed'
251 $status = $this->mUpload->addChunk(
252 $chunkPath, $chunkSize, $this->mParams[
'offset'] );
253 if ( !$status->isGood() ) {
254 $this->
dieUsage( $status->getWikiText(),
'stashfailed' );
259 if ( $totalSoFar == $this->mParams[
'filesize'] ) {
260 if ( $this->mParams[
'async'] ) {
261 UploadBase::setSessionStatus(
263 array(
'result' =>
'Poll',
269 'filename' => $this->mParams[
'filename'],
270 'filekey' => $filekey,
277 UploadBase::setSessionStatus( $filekey,
false );
279 "Failed to start AssembleUploadChunks.php",
'stashfailed' );
282 $status = $this->mUpload->concatenateChunks();
283 if ( !$status->isGood() ) {
284 UploadBase::setSessionStatus(
287 array(
'result' =>
'Failure',
'stage' =>
'assembling',
'status' => $status )
289 $this->
dieUsage( $status->getWikiText(),
'stashfailed' );
294 UploadBase::setSessionStatus( $this->
getUser(), $filekey,
false );
295 $this->mUpload->stash->removeFile( $filekey );
296 $filekey = $this->mUpload->getLocalFile()->getFileKey();
301 UploadBase::setSessionStatus(
305 'result' =>
'Continue',
306 'stage' =>
'uploading',
307 'offset' => $totalSoFar,
311 $result[
'result'] =
'Continue';
312 $result[
'offset'] = $totalSoFar;
327 $stashFile = $this->mUpload->stashFile();
332 $fileKey = $stashFile->getFileKey();
334 $message =
'Stashing temporary file failed: ' . get_class(
$e ) .
' ' .
$e->getMessage();
335 wfDebug( __METHOD__ .
' ' . $message .
"\n" );
354 $data[
'sessionkey'] = $data[
'filekey'];
356 $data[
'stashfailed'] =
$e->getMessage();
358 $data[
'invalidparameter'] = $parameter;
361 $this->
dieUsage( $parsed[
'info'], $parsed[
'code'], 0, $data );
372 $request = $this->
getMain()->getRequest();
375 if ( !$this->mParams[
'chunk'] ) {
377 'filekey',
'file',
'url',
'statuskey' );
381 if ( $this->mParams[
'filekey'] && $this->mParams[
'checkstatus'] ) {
382 $progress = UploadBase::getSessionStatus( $this->mParams[
'filekey'] );
384 $this->
dieUsage(
'No result in status data',
'missingresult' );
385 } elseif ( !$progress[
'status']->isGood() ) {
386 $this->
dieUsage( $progress[
'status']->getWikiText(),
'stashfailed' );
388 if ( isset( $progress[
'status']->value[
'verification'] ) ) {
391 unset( $progress[
'status'] );
397 if ( $this->mParams[
'statuskey'] ) {
402 if ( !isset( $sessionData[
'result'] ) ) {
403 $this->
dieUsage(
'No result in session data',
'missingresult' );
405 if ( $sessionData[
'result'] ==
'Warning' ) {
407 $sessionData[
'sessionkey'] = $this->mParams[
'statuskey'];
415 if ( is_null( $this->mParams[
'filename'] ) ) {
419 if ( $this->mParams[
'chunk'] ) {
422 if ( isset( $this->mParams[
'filekey'] ) ) {
423 if ( $this->mParams[
'offset'] === 0 ) {
424 $this->
dieUsage(
'Cannot supply a filekey when offset is 0',
'badparams' );
428 $this->mUpload->continueChunks(
429 $this->mParams[
'filename'],
430 $this->mParams[
'filekey'],
431 $request->getUpload(
'chunk' )
435 $this->mUpload->initialize(
436 $this->mParams[
'filename'],
437 $request->getUpload(
'chunk' )
440 } elseif ( isset( $this->mParams[
'filekey'] ) ) {
449 $this->mUpload->initialize(
450 $this->mParams[
'filekey'], $this->mParams[
'filename'], !$this->mParams[
'async']
452 } elseif ( isset( $this->mParams[
'file'] ) ) {
454 $this->mUpload->initialize(
455 $this->mParams[
'filename'],
456 $request->getUpload(
'file' )
458 } elseif ( isset( $this->mParams[
'url'] ) ) {
473 if ( $this->mParams[
'asyncdownload'] ) {
476 if ( $this->mParams[
'leavemessage'] && !$this->mParams[
'ignorewarnings'] ) {
477 $this->
dieUsage(
'Using leavemessage without ignorewarnings is not supported',
478 'missing-ignorewarnings' );
481 if ( $this->mParams[
'leavemessage'] ) {
482 $async =
'async-leavemessage';
488 $this->mUpload->
initialize( $this->mParams[
'filename'],
489 $this->mParams[
'url'], $async );
502 $permission = $this->mUpload->isAllowed(
$user );
504 if ( $permission !==
true ) {
505 if ( !
$user->isLoggedIn() ) {
517 $verification = $this->mUpload->verifyUpload();
518 if ( $verification[
'status'] === UploadBase::OK ) {
532 switch ( $verification[
'status'] ) {
534 case UploadBase::MIN_LENGTH_PARTNAME:
537 case UploadBase::ILLEGAL_FILENAME:
539 array(
'filename' => $verification[
'filtered'] ) );
541 case UploadBase::FILENAME_TOO_LONG:
544 case UploadBase::FILETYPE_MISSING:
547 case UploadBase::WINDOWS_NONASCII_FILENAME:
552 case UploadBase::EMPTY_FILE:
553 $this->
dieUsage(
'The file you submitted was empty',
'empty-file' );
555 case UploadBase::FILE_TOO_LARGE:
556 $this->
dieUsage(
'The file you submitted was too large',
'file-too-large' );
559 case UploadBase::FILETYPE_BADTYPE:
561 'filetype' => $verification[
'finalExt'],
564 $this->
getResult()->setIndexedTagName( $extradata[
'allowed'],
'ext' );
566 $msg =
"Filetype not permitted: ";
567 if ( isset( $verification[
'blacklistedExt'] ) ) {
568 $msg .= join(
', ', $verification[
'blacklistedExt'] );
569 $extradata[
'blacklisted'] = array_values( $verification[
'blacklistedExt'] );
570 $this->
getResult()->setIndexedTagName( $extradata[
'blacklisted'],
'ext' );
572 $msg .= $verification[
'finalExt'];
574 $this->
dieUsage( $msg,
'filetype-banned', 0, $extradata );
576 case UploadBase::VERIFICATION_ERROR:
577 $this->
getResult()->setIndexedTagName( $verification[
'details'],
'detail' );
578 $this->
dieUsage(
'This file did not pass file verification',
'verification-error',
579 0,
array(
'details' => $verification[
'details'] ) );
581 case UploadBase::HOOK_ABORTED:
582 $this->
dieUsage(
"The modification you tried to make was aborted by an extension hook",
583 'hookaborted', 0,
array(
'error' => $verification[
'error'] ) );
586 $this->
dieUsage(
'An unknown error occurred',
'unknown-error',
587 0,
array(
'code' => $verification[
'status'] ) );
600 $warnings = $this->mUpload->checkWarnings();
609 $result->setIndexedTagName( $warnings,
'warning' );
611 if ( isset( $warnings[
'duplicate'] ) ) {
613 foreach ( $warnings[
'duplicate']
as $dupe ) {
614 $dupes[] = $dupe->getName();
616 $result->setIndexedTagName( $dupes,
'duplicate' );
617 $warnings[
'duplicate'] = $dupes;
620 if ( isset( $warnings[
'exists'] ) ) {
621 $warning = $warnings[
'exists'];
622 unset( $warnings[
'exists'] );
623 $localFile = isset( $warning[
'normalizedFile'] )
624 ? $warning[
'normalizedFile']
626 $warnings[$warning[
'warning']] = $localFile->getName();
642 if ( is_null( $this->mParams[
'text'] ) ) {
643 $this->mParams[
'text'] = $this->mParams[
'comment'];
647 $file = $this->mUpload->getLocalFile();
654 $this->mParams[
'watchlist'],
$file->getTitle(),
'watchdefault'
656 if ( !$watch && $this->mParams[
'watchlist'] ==
'preferences' && !
$file->exists() ) {
658 $this->mParams[
'watchlist'],
$file->getTitle(),
'watchcreations'
663 if ( $this->mParams[
'watch'] ) {
668 if ( $this->mParams[
'async'] ) {
669 $progress = UploadBase::getSessionStatus( $this->mParams[
'filekey'] );
670 if ( $progress && $progress[
'result'] ===
'Poll' ) {
671 $this->
dieUsage(
"Upload from stash already in progress.",
'publishfailed' );
673 UploadBase::setSessionStatus(
674 $this->mParams[
'filekey'],
680 'filename' => $this->mParams[
'filename'],
681 'filekey' => $this->mParams[
'filekey'],
682 'comment' => $this->mParams[
'comment'],
683 'text' => $this->mParams[
'text'],
691 UploadBase::setSessionStatus( $this->mParams[
'filekey'],
false );
693 "Failed to start PublishStashedFile.php",
'publishfailed' );
697 $status = $this->mUpload->performUpload( $this->mParams[
'comment'],
698 $this->mParams[
'text'], $watch, $this->
getUser() );
700 if ( !$status->isGood() ) {
701 $error = $status->getErrorsArray();
703 if ( count(
$error ) == 1 &&
$error[0][0] ==
'async' ) {
707 'result' =>
'Queued',
708 'statuskey' =>
$error[0][1],
713 $this->
dieUsage(
'An internal error occurred',
'internal-error', 0,
$error );
719 if ( $warnings && count( $warnings ) > 0 ) {
720 $result[
'warnings'] = $warnings;
730 global $wgAllowAsyncCopyUploads;
731 if ( !$wgAllowAsyncCopyUploads ) {
732 $this->
dieUsage(
'Asynchronous copy uploads disabled',
'asynccopyuploaddisabled' );
761 'watchlist' =>
array(
769 'ignorewarnings' =>
false,
775 'sessionkey' =>
array(
795 'asyncdownload' =>
false,
796 'leavemessage' =>
false,
798 'checkstatus' =>
false,
806 'filename' =>
'Target filename',
807 'token' =>
'Edit token. You can get one of these through prop=info',
808 'comment' =>
'Upload comment. Also used as the initial page text for new ' .
809 'files if "text" is not specified',
810 'text' =>
'Initial page text for new files',
811 'watch' =>
'Watch the page',
812 'watchlist' =>
'Unconditionally add or remove the page from your watchlist, ' .
813 'use preferences or do not change watch',
814 'ignorewarnings' =>
'Ignore any warnings',
815 'file' =>
'File contents',
816 'url' =>
'URL to fetch the file from',
817 'filekey' =>
'Key that identifies a previous upload that was stashed temporarily.',
818 'sessionkey' =>
'Same as filekey, maintained for backward compatibility.',
819 'stash' =>
'If set, the server will not add the file to the repository ' .
820 'and stash it temporarily.',
822 'chunk' =>
'Chunk contents',
823 'offset' =>
'Offset of chunk in bytes',
824 'filesize' =>
'Filesize of entire upload',
826 'async' =>
'Make potentially large file operations asynchronous when possible',
827 'asyncdownload' =>
'Make fetching a URL asynchronous',
828 'leavemessage' =>
'If asyncdownload is used, leave a message on the user talk page if finished',
829 'statuskey' =>
'Fetch the upload status for this file key (upload by URL)',
830 'checkstatus' =>
'Only fetch the upload status for the given file key',
851 'sessionkey' =>
array(
859 'statuskey' =>
array(
873 'Upload a file, or get the status of pending uploads. Several methods are available:',
874 ' * Upload file contents directly, using the "file" parameter',
875 ' * Have the MediaWiki server fetch a file from a URL, using the "url" parameter',
876 ' * Complete an earlier upload that failed due to warnings, using the "filekey" parameter',
877 'Note that the HTTP POST must be done as a file upload (i.e. using multipart/form-data) when',
878 'sending the "file". Also you must get and send an edit token before doing any upload stuff.'
883 return array_merge( parent::getPossibleErrors(),
886 array(
'uploaddisabled' ),
887 array(
'invalid-file-key' ),
888 array(
'uploaddisabled' ),
889 array(
'mustbeloggedin',
'upload' ),
890 array(
'badaccess-groups' ),
891 array(
'code' =>
'fetchfileerror',
'info' =>
'' ),
892 array(
'code' =>
'nomodule',
'info' =>
'No upload module set' ),
893 array(
'code' =>
'empty-file',
'info' =>
'The file you submitted was empty' ),
894 array(
'code' =>
'filetype-missing',
'info' =>
'The file is missing an extension' ),
895 array(
'code' =>
'filename-tooshort',
'info' =>
'The filename is too short' ),
896 array(
'code' =>
'overwrite',
'info' =>
'Overwriting an existing file is not allowed' ),
897 array(
'code' =>
'stashfailed',
'info' =>
'Stashing temporary file failed' ),
898 array(
'code' =>
'publishfailed',
'info' =>
'Publishing of stashed file failed' ),
899 array(
'code' =>
'internal-error',
'info' =>
'An internal error occurred' ),
900 array(
'code' =>
'asynccopyuploaddisabled',
'info' =>
'Asynchronous copy uploads disabled' ),
901 array(
'code' =>
'stasherror',
'info' =>
'An upload stash error occurred' ),
902 array(
'fileexists-forbidden' ),
903 array(
'fileexists-shared-forbidden' ),
918 'api.php?action=upload&filename=Wiki.png' .
919 '&url=http%3A//upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png'
920 =>
'Upload from a URL',
921 'api.php?action=upload&filename=Wiki.png&filekey=filekey&ignorewarnings=1'
922 =>
'Complete an upload that failed due to warnings',
927 return 'https://www.mediawiki.org/wiki/API:Upload';
getChunkResult( $warnings)
Get the result of a chunk upload.
getConfig()
Get the Config object.
selectUploadModule()
Select an upload module and set it to mUpload.
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
getContext()
Get the RequestContext object.
isWriteMode()
Indicates whether this module requires write mode.
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
getStashResult( $warnings)
Get Stash Result, throws an exception if the file could not be stashed.
parseMsg( $error)
Return the error message related to a certain array.
getPossibleErrors()
Returns a list of all possible errors returned by the module.
verifyUpload()
Performs file verification, dies on error.
dieUsageMsg( $error)
Output the error message related to a certain array.
getResult()
Get the result object.
getWarningsResult( $warnings)
Get Warnings Result.
static newGood( $value=null)
Factory function for good results.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
getExamples()
Returns usage examples for this module.
getApiWarnings()
Check warnings.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
Implements uploading from previously stored file.
getTokenSalt()
Returns the token salt if there is one, '' if the module doesn't require a salt, else false if the mo...
getUser()
Get the User object.
This abstract class implements many basic API functions, and is the base of all API classes.
static & getSessionData( $key)
Upload a file from the upload stash into the local file repo.
initialize( $name, $url, $async=false)
Entry point for API upload.
Implements uploading from a HTTP resource.
dieRecoverableError( $error, $parameter, $data=array())
Throw an error that the user can recover from by providing a better value for $parameter.
static isEnabled()
Checks if the upload from URL feature is enabled.
getContextResult()
Get an upload result based on upload context.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
if(! $wgHtml5Version && $wgAllowRdfaAttributes) $wgFileExtensions
getRequireOnlyOneParameterErrorMessages( $params)
Generates the possible errors requireOnlyOneParameter() can die with.
getParamDescription()
Returns an array of parameter descriptions.
getWatchlistValue( $watchlist, $titleObj, $userOption=null)
Return true if we're to watch the page, false if not, null if no change.
needsToken()
Returns whether this module requires a token to execute It is used to show possible errors in action=...
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
static isAllowedUrl( $url)
Checks whether the URL is not allowed.
getResultProperties()
Returns possible properties in the result, grouped by the value of the prop parameter that shows them...
dieUsage( $description, $errorCode, $httpRespCode=0, $extradata=null)
Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an...
Assemble the segments of a chunked upload.
requireOnlyOneParameter( $params)
Die if none or more than one of a certain set of parameters is set and not false.
performStash()
Stash the file and return the file key Also re-raises exceptions with slightly more informative messa...
mustBePosted()
Indicates whether this module must be called with a POST request.
performUpload( $warnings)
Perform the actual upload.
static isAllowedHost( $url)
Checks whether the URL is for an allowed host The domains in the whitelist can include wildcard chara...
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
if(PHP_SAPI !='cli') $file
exportSession()
Export the resolved user IP, HTTP headers, user ID, and session ID.
static singleton( $wiki=false)
checkPermissions( $user)
Checks that the user has permissions to perform this upload.
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
getModuleName()
Get the name of the module being executed by this instance.
getMain()
Get the main module.
checkAsyncDownloadEnabled()
Checks if asynchronous copy uploads are enabled and throws an error if they are not.
Implements uploading from chunks.
transformWarnings( $warnings)
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 where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string as detected by MediaWiki Handlers will typically only apply for specific mime types object & $error
Implements regular file uploads.
getDescription()
Returns the description string for this module.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
checkVerification(array $verification)
Performs file verification, dies on error.