48use Psr\Log\LoggerInterface;
50use UnexpectedValueException;
72 private LoggerInterface $log;
86 parent::__construct(
'Upload',
'upload' );
89 $this->jobQueueGroup = $services->getJobQueueGroup();
90 $repoGroup ??= $services->getRepoGroup();
91 $this->localRepo = $repoGroup->getLocalRepo();
92 $this->userOptionsLookup = $userOptionsLookup ?? $services->getUserOptionsLookup();
93 $this->nsInfo = $nsInfo ?? $services->getNamespaceInfo();
94 $this->watchlistManager = $watchlistManager ?? $services->getWatchlistManager();
99 $this->log = LoggerFactory::getInstance(
'SpecialUpload' );
161 $this->mRequest = $request = $this->
getRequest();
162 $this->mSourceType = $request->getVal(
'wpSourceType',
'file' );
163 $this->mUpload = UploadBase::createFromRequest( $request );
164 $this->mUploadClicked = $request->wasPosted()
165 && ( $request->getCheck(
'wpUpload' )
166 || $request->getCheck(
'wpUploadIgnoreWarning' ) );
169 $this->mDesiredDestName = $request->getText(
'wpDestFile' );
170 if ( !$this->mDesiredDestName && $request->getFileName(
'wpUploadFile' ) !== null ) {
171 $this->mDesiredDestName = $request->getFileName(
'wpUploadFile' );
173 $this->mLicense = $request->getText(
'wpLicense' );
175 $this->mDestWarningAck = $request->getText(
'wpDestFileWarningAck' );
176 $this->mIgnoreWarning = $request->getCheck(
'wpIgnoreWarning' )
177 || $request->getCheck(
'wpUploadIgnoreWarning' );
178 $this->mWatchthis = $request->getBool(
'wpWatchthis' ) && $this->
getUser()->isRegistered();
179 $this->mCopyrightStatus = $request->getText(
'wpUploadCopyStatus' );
180 $this->mCopyrightSource = $request->getText(
'wpUploadSource' );
182 $this->mForReUpload = $request->getBool(
'wpForReUpload' );
184 $commentDefault =
'';
185 $commentMsg = $this->
msg(
'upload-default-description' )->inContentLanguage();
186 if ( !$this->mForReUpload && !$commentMsg->isDisabled() ) {
187 $commentDefault = $commentMsg->plain();
189 $this->mComment = $request->getText(
'wpUploadDescription', $commentDefault );
191 $this->mCancelUpload = $request->getCheck(
'wpCancelUpload' )
192 || $request->getCheck(
'wpReUpload' );
195 $token = $request->getVal(
'wpEditToken' );
196 $this->mTokenOk = $this->
getUser()->matchEditToken( $token );
201 $this->mCacheKey = \UploadFromUrl::getCacheKeyFromRequest( $request );
203 $this->mCacheKey =
'';
206 $this->uploadFormTextTop =
'';
207 $this->uploadFormTextAfterSummary =
'';
216 return ( $this->mSourceType ===
'url' && $this->allowAsync );
228 return UploadBase::isEnabled() && parent::userCanExecute( $user );
240 # Check uploading enabled
241 if ( !UploadBase::isEnabled() ) {
242 throw new ErrorPageError(
'uploaddisabled',
'uploaddisabledtext' );
249 $permissionRequired = UploadBase::isAllowed( $user );
250 if ( $permissionRequired !==
true ) {
255 if ( $user->isBlockedFromUpload() ) {
260 $this->getLanguage(),
261 $this->getRequest()->getIP()
265 # Check whether we actually want to allow changing stuff
270 # Unsave the temporary file in case this was a cancelled upload
272 # Something went wrong, so unsaveUploadedFile showed a warning
276 # If we have a cache key, show the upload status.
277 if ( $this->mTokenOk && $this->mCacheKey !==
'' ) {
278 if ( $this->mUpload && $this->mUploadClicked && !$this->mCancelUpload ) {
279 # If the user clicked the upload button, we need to process the upload
282 # Show the upload status
286 # Process upload or show a form
287 $this->mTokenOk && !$this->mCancelUpload &&
288 ( $this->mUpload && $this->mUploadClicked )
292 # Backwards compatibility hook
293 if ( !$this->
getHookRunner()->onUploadForm_initial( $this ) ) {
294 wfDebug(
"Hook 'UploadForm:initial' broke output of the upload form" );
302 if ( $this->mUpload ) {
303 $this->mUpload->cleanupTempFile();
314 $progress = UploadBase::getSessionStatus( $user, $this->mCacheKey );
316 $progress = [
'status' => Status::newFatal(
'invalid-cache-key' ) ];
318 $this->log->debug(
'Upload status: stage {stage}, result {result}', $progress );
320 $status = $progress[
'status'] ?? Status::newFatal(
'invalid-cache-key' );
321 $stage = $progress[
'stage'] ??
'unknown';
322 $result = $progress[
'result'] ??
'unknown';
330 $this->mUploadSuccessful =
true;
334 $title = Title::makeTitleSafe(
NS_FILE, $this->mRequest->getText(
'wpDestFile' ) );
336 $this->log->debug(
'Purging page', [
'title' => $title->getText() ] );
340 $this->
getOutput()->redirect( $this->mRequest->getText(
'wpDestUrl' ) );
343 $this->
showUploadWarning( UploadBase::unserializeWarnings( $progress[
'warnings'] ) );
346 $details = $status->getValue();
348 if ( is_array( $details ) && isset( $details[
'verification'] ) ) {
352 $status->getWikiText(
false,
false, $this->getLanguage() ) )
357 $this->showUploadProgress(
358 [
'active' =>
true,
'msg' =>
'upload-progress-processing' ]
364 $status->getWikiText(
false,
false, $this->getLanguage() ) )
371 $this->showUploadProgress( [
'active' =>
false,
'msg' =>
'upload-progress-queued' ] );
378 $this->showUploadProgress( [
'active' =>
true,
'msg' =>
'upload-progress-downloading' ] );
383 $status->getWikiText(
false,
false, $this->getLanguage() ) )
389 $status->getWikiText(
false,
false, $this->getLanguage() ) )
396 if ( $status->isOK() ) {
397 $status = Status::newFatal(
'upload-progress-unknown' );
399 $statusmsg = $this->
getOutput()->parseAsInterface(
400 $status->getWikiText(
false,
false, $this->getLanguage() )
402 $message =
'<h2>' . $this->
msg(
'uploaderror' )->escaped() .
'</h2>' . HTML::errorBox( $statusmsg );
418 private function showUploadProgress( $options ) {
421 $message = $this->
msg( $options[
'msg'] )->escaped();
422 $destUrl = $this->mRequest->getText(
'wpDestUrl',
'' );
423 if ( !$destUrl && $this->mUpload ) {
424 if ( !$this->mLocalFile ) {
425 $this->mLocalFile = $this->mUpload->getLocalFile();
429 if ( $this->mLocalFile ===
null ) {
432 $destUrl = $this->mLocalFile->getTitle()->getFullURL();
438 $destName = $this->mRequest->getText(
'wpDestFile' );
442 $sourceURL = $this->mRequest->getText(
'wpUploadFileURL' );
444 $form =
new HTMLForm( [
447 'default' => $this->mCacheKey,
451 'default' => $this->mSourceType,
455 'default' => $destUrl,
459 'default' => $destName,
463 'default' => $sourceURL,
466 $form->setSubmitText( $this->
msg(
'upload-refresh' )->escaped() );
469 $preHtml =
"<div id='upload-progress-message'>$message</div>";
470 $form->addPreHtml( $preHtml );
471 $form->setSubmitCallback(
472 static function ( $formData ) {
476 $form->prepareForm();
477 $this->
getOutput()->addHTML( $form->getHTML(
false ) );
501 protected function getUploadForm( $message =
'', $sessionKey =
'', $hideIgnoreWarning =
false ) {
506 'forreupload' => $this->mForReUpload,
507 'sessionkey' => $sessionKey,
508 'hideignorewarning' => $hideIgnoreWarning,
509 'destwarningack' => (
bool)$this->mDestWarningAck,
511 'description' => $this->mComment,
512 'texttop' => $this->uploadFormTextTop,
513 'textaftersummary' => $this->uploadFormTextAfterSummary,
514 'destfile' => $this->mDesiredDestName,
525 # Check the token, but only if necessary
527 !$this->mTokenOk && !$this->mCancelUpload &&
528 ( $this->mUpload && $this->mUploadClicked )
530 $form->addPreHtml( $this->
msg(
'session_fail_preview' )->parse() );
533 # Give a notice if the user is uploading a file that has been deleted or moved
534 # Note that this is independent from the message 'filewasdeleted'
535 $desiredTitleObj = Title::makeTitleSafe(
NS_FILE, $this->mDesiredDestName );
537 if ( $desiredTitleObj instanceof
Title && !$desiredTitleObj->
exists() ) {
538 LogEventsList::showLogExtract( $delNotice, [
'delete',
'move' ],
541 'conds' => [ $this->localRepo->getReplicaDB()->expr(
'log_action',
'!=',
'revision' ) ],
542 'showIfEmpty' =>
false,
543 'msgKey' => [
'upload-recreate-warning' ] ]
546 $form->addPreHtml( $delNotice );
549 $form->addPreHtml(
'<div id="uploadtext">' .
550 $this->
msg(
'uploadtext', [ $this->mDesiredDestName ] )->parseAsBlock() .
552 # Add upload error message
553 $form->addPreHtml( $message );
556 $uploadFooter = $this->
msg(
'uploadfooter' );
557 if ( !$uploadFooter->isDisabled() ) {
558 $form->addPostHtml(
'<div id="mw-upload-footer-message">'
559 . $uploadFooter->parseAsBlock() .
"</div>\n" );
577 $stashStatus = $this->mUpload->tryStashFile( $this->
getUser() );
578 if ( $stashStatus->isGood() ) {
579 $sessionKey = $stashStatus->getValue()->getFileKey();
580 $uploadWarning =
'upload-tryagain';
583 $uploadWarning =
'upload-tryagain-nostash';
585 $message =
'<h2>' . $this->
msg(
'uploaderror' )->escaped() .
'</h2>' .
586 Html::errorBox( $message );
589 $form->setSubmitText( $this->
msg( $uploadWarning )->escaped() );
602 # If there are no warnings, or warnings we can ignore, return early.
603 # mDestWarningAck is set when some javascript has shown the warning
604 # to the user. mForReUpload is set when the user clicks the "upload a
606 if ( !$warnings || ( count( $warnings ) == 1
607 && isset( $warnings[
'exists'] )
608 && ( $this->mDestWarningAck || $this->mForReUpload ) )
613 if ( $this->mUpload ) {
614 $stashStatus = $this->mUpload->tryStashFile( $this->
getUser() );
615 if ( $stashStatus->isGood() ) {
616 $sessionKey = $stashStatus->getValue()->getFileKey();
617 $uploadWarning =
'uploadwarning-text';
620 $uploadWarning =
'uploadwarning-text-nostash';
624 $uploadWarning =
'uploadwarning-text-nostash';
628 $this->
getOutput()->addModuleStyles(
'mediawiki.special' );
631 $warningHtml =
'<h2>' . $this->
msg(
'uploadwarning' )->escaped() .
"</h2>\n"
632 .
'<div class="mw-destfile-warning"><ul>';
633 foreach ( $warnings as $warning => $args ) {
634 if ( $warning ==
'badfilename' ) {
635 $this->mDesiredDestName = Title::makeTitle(
NS_FILE, $args )->getText();
637 if ( $warning ==
'exists' ) {
639 } elseif ( $warning ==
'no-change' ) {
641 $filename = $file->getTitle()->getPrefixedText();
642 $msg =
"\t<li>" . $this->
msg(
'fileexists-no-change', $filename )->parse() .
"</li>\n";
643 } elseif ( $warning ==
'duplicate-version' ) {
645 $count = count( $args );
646 $filename = $file->getTitle()->getPrefixedText();
647 $message = $this->
msg(
'fileexists-duplicate-version' )
648 ->params( $filename )
649 ->numParams( $count );
650 $msg =
"\t<li>" . $message->parse() .
"</li>\n";
651 } elseif ( $warning ==
'was-deleted' ) {
652 # If the file existed before and was deleted, warn the user of this
654 $llink = $linkRenderer->makeKnownLink(
656 $this->
msg(
'deletionlog' )->text(),
660 'page' => Title::makeTitle(
NS_FILE, $args )->getPrefixedText(),
663 $msg =
"\t<li>" . $this->
msg(
'filewasdeleted' )->rawParams( $llink )->parse() .
"</li>\n";
664 } elseif ( $warning ==
'duplicate' ) {
666 } elseif ( $warning ==
'duplicate-archive' ) {
667 if ( $args ===
'' ) {
668 $msg =
"\t<li>" . $this->
msg(
'file-deleted-duplicate-notitle' )->parse()
671 $msg =
"\t<li>" . $this->
msg(
'file-deleted-duplicate',
672 Title::makeTitle(
NS_FILE, $args )->getPrefixedText() )->parse()
676 if ( $args ===
true ) {
678 } elseif ( !is_array( $args ) ) {
681 $msg =
"\t<li>" . $this->
msg( $warning, $args )->parse() .
"</li>\n";
683 $warningHtml .= $msg;
685 $warningHtml .=
"</ul></div>\n";
686 $warningHtml .= $this->
msg( $uploadWarning )->parseAsBlock();
688 $form = $this->
getUploadForm( $warningHtml, $sessionKey,
true );
689 $form->setSubmitTextMsg(
'upload-tryagain' );
691 'name' =>
'wpUploadIgnoreWarning',
692 'value' => $this->
msg(
'ignorewarning' )->text()
695 'name' =>
'wpCancelUpload',
696 'value' => $this->
msg(
'reuploaddesc' )->text()
701 # Indicate that we showed a form
711 $message =
'<h2>' . $this->
msg(
'uploadwarning' )->escaped() .
'</h2>' .
712 Html::errorBox( $message );
723 if ( !$fetchFileStatus->isOK() ) {
725 $fetchFileStatus->getWikiText(
false,
false, $this->getLanguage() )
730 if ( !$this->
getHookRunner()->onUploadForm_BeforeProcessing( $this ) ) {
731 wfDebug(
"Hook 'UploadForm:BeforeProcessing' broke processing the file." );
745 $details = $this->mUpload->verifyUpload();
746 if ( $details[
'status'] != UploadBase::OK ) {
754 $permErrors = $this->mUpload->verifyTitlePermissions( $user );
755 if ( $permErrors !==
true ) {
756 $code = array_shift( $permErrors[0] );
762 $this->mLocalFile = $this->mUpload->getLocalFile();
765 if ( !$this->mIgnoreWarning ) {
766 $warnings = $this->mUpload->checkWarnings( $user );
782 if ( !$this->mForReUpload ) {
783 $pageText = self::getInitialPageText( $this->mComment, $this->mLicense,
784 $this->mCopyrightStatus, $this->mCopyrightSource,
785 $this->getConfig() );
789 $changeTags = $this->
getRequest()->getVal(
'wpChangeTags' );
790 if ( $changeTags ===
null || $changeTags ===
'' ) {
793 $changeTags = array_filter( array_map(
'trim', explode(
',', $changeTags ) ) );
797 $changeTags, $this->
getUser() );
798 if ( !$changeTagsStatus->isOK() ) {
799 $this->showUploadError( $this->getOutput()->parseAsInterface(
800 $changeTagsStatus->getWikiText(
false,
false, $this->getLanguage() )
806 return [ $pageText, $changeTags ];
815 $status = $this->mUpload->fetchFile();
816 if ( !$this->performUploadChecks( $status ) ) {
820 $pageAndTags = $this->getPageTextAndTags();
821 if ( $pageAndTags ===
null ) {
824 [ $pageText, $changeTags ] = $pageAndTags;
826 $status = $this->mUpload->performUpload(
834 if ( !$status->isGood() ) {
835 $this->showRecoverableUploadError(
836 $this->getOutput()->parseAsInterface(
837 $status->getWikiText(
false,
false, $this->getLanguage() )
845 $this->mUploadSuccessful =
true;
846 $this->getHookRunner()->onSpecialUploadComplete( $this );
847 $this->getOutput()->redirect( $this->mLocalFile->getTitle()->getFullURL() );
856 $this->showUploadError( $this->msg(
'uploaderror' )->escaped() );
861 $status = $this->mUpload->canFetchFile();
862 if ( !$this->performUploadChecks( $status ) ) {
863 $this->log->debug(
'Upload failed verification: {error}', [
'error' => $status ] );
867 $pageAndTags = $this->getPageTextAndTags();
868 if ( $pageAndTags ===
null ) {
871 [ $pageText, $changeTags ] = $pageAndTags;
874 $job = new \UploadFromUrlJob(
876 'filename' => $this->mUpload->getDesiredDestName(),
877 'url' => $this->mUpload->getUrl(),
878 'comment' => $this->mComment,
879 'tags' => $changeTags,
881 'watch' => $this->mWatchthis,
882 'watchlistexpiry' =>
null,
883 'session' => $this->getContext()->exportSession(),
884 'reupload' => $this->mForReUpload,
885 'ignorewarnings' => $this->mIgnoreWarning,
889 $cacheKey =
$job->getCacheKey();
890 UploadBase::setSessionStatus( $this->
getUser(), $cacheKey, [
891 'status' => Status::newGood(),
895 $this->log->info(
"Submitting UploadFromUrlJob for {filename}",
896 [
'filename' => $this->mUpload->getDesiredDestName() ]
899 $this->jobQueueGroup->push(
$job );
901 $this->showUploadStatus( $this->
getUser() );
916 if ( $config ===
null ) {
917 wfDebug( __METHOD__ .
' called without a Config instance passed to it' );
927 foreach ( [
'license-header',
'filedesc',
'filestatus',
'filesource' ] as $msgName ) {
928 if ( in_array( $msgName, $forceUIMsgAsContentMsg ) ) {
929 $msg[$msgName] =
"{{int:$msgName}}";
931 $msg[$msgName] =
wfMessage( $msgName )->inContentLanguage()->text();
936 if ( $license !==
'' ) {
937 $licenseText =
'== ' . $msg[
'license-header'] .
" ==\n{{" . $license .
"}}\n";
940 $pageText = $comment .
"\n";
941 $headerText =
'== ' . $msg[
'filedesc'] .
' ==';
942 if ( $comment !==
'' && !str_contains( $comment, $headerText ) ) {
944 $pageText = $headerText .
"\n" . $pageText;
948 $pageText .=
'== ' . $msg[
'filestatus'] .
" ==\n" . $copyStatus .
"\n";
949 $pageText .= $licenseText;
950 $pageText .=
'== ' . $msg[
'filesource'] .
" ==\n" .
$source;
952 $pageText .= $licenseText;
957 ->onUploadForm_getInitialPageText( $pageText, $msg, $config );
976 if ( $this->userOptionsLookup->getBoolOption( $user,
'watchdefault' ) ) {
981 $desiredTitleObj = Title::makeTitleSafe(
NS_FILE, $this->mDesiredDestName );
982 if ( $desiredTitleObj instanceof
Title &&
983 $this->watchlistManager->isWatched( $user, $desiredTitleObj ) ) {
988 $local = $this->localRepo->newFile( $this->mDesiredDestName );
989 if ( $local && $local->exists() ) {
995 return $this->userOptionsLookup->getBoolOption( $user,
'watchcreations' ) ||
996 $this->userOptionsLookup->getBoolOption( $user,
'watchuploads' );
1006 switch ( $details[
'status'] ) {
1008 case UploadBase::MIN_LENGTH_PARTNAME:
1009 $this->showRecoverableUploadError( $this->msg(
'minlength1' )->escaped() );
1011 case UploadBase::ILLEGAL_FILENAME:
1012 $this->showRecoverableUploadError( $this->msg(
'illegalfilename',
1013 $details[
'filtered'] )->parse() );
1015 case UploadBase::FILENAME_TOO_LONG:
1016 $this->showRecoverableUploadError( $this->msg(
'filename-toolong' )->escaped() );
1018 case UploadBase::FILETYPE_MISSING:
1019 $this->showRecoverableUploadError( $this->msg(
'filetype-missing' )->parse() );
1021 case UploadBase::WINDOWS_NONASCII_FILENAME:
1022 $this->showRecoverableUploadError( $this->msg(
'windows-nonascii-filename' )->parse() );
1026 case UploadBase::EMPTY_FILE:
1027 $this->showUploadError( $this->msg(
'emptyfile' )->escaped() );
1029 case UploadBase::FILE_TOO_LARGE:
1030 $this->showUploadError( $this->msg(
'largefileserver' )->escaped() );
1032 case UploadBase::FILETYPE_BADTYPE:
1033 $msg = $this->msg(
'filetype-banned-type' );
1034 if ( isset( $details[
'blacklistedExt'] ) ) {
1035 $msg->params( $this->getLanguage()->commaList( $details[
'blacklistedExt'] ) );
1037 $msg->params( $details[
'finalExt'] );
1041 $msg->params( $this->getLanguage()->commaList( $extensions ),
1042 count( $extensions ) );
1047 if ( isset( $details[
'blacklistedExt'] ) ) {
1048 $msg->params( count( $details[
'blacklistedExt'] ) );
1053 $this->showUploadError( $msg->parse() );
1055 case UploadBase::VERIFICATION_ERROR:
1056 unset( $details[
'status'] );
1057 $code = array_shift( $details[
'details'] );
1058 $this->showUploadError( $this->msg( $code, $details[
'details'] )->parse() );
1060 case UploadBase::HOOK_ABORTED:
1061 if ( is_array( $details[
'error'] ) ) { # allow hooks to
return error details in an array
1062 $args = $details[
'error'];
1063 $error = array_shift( $args );
1065 $error = $details[
'error'];
1069 $this->showUploadError( $this->msg( $error, $args )->parse() );
1072 throw new UnexpectedValueException( __METHOD__ .
": Unknown value `{$details['status']}`" );
1085 $success = $this->mUpload->unsaveUploadedFile();
1087 $this->getOutput()->showErrorPage(
1090 [ $this->mUpload->getTempPath() ]
1113 $file = $exists[
'file'];
1114 $filename = $file->getTitle()->getPrefixedText();
1117 if ( $exists[
'warning'] ==
'exists' ) {
1119 $warnMsg =
wfMessage(
'fileexists', $filename );
1120 } elseif ( $exists[
'warning'] ==
'page-exists' ) {
1122 $warnMsg =
wfMessage(
'filepageexists', $filename );
1123 } elseif ( $exists[
'warning'] ==
'exists-normalized' ) {
1124 $warnMsg =
wfMessage(
'fileexists-extension', $filename,
1125 $exists[
'normalizedFile']->
getTitle()->getPrefixedText() );
1126 } elseif ( $exists[
'warning'] ==
'thumb' ) {
1128 $warnMsg =
wfMessage(
'fileexists-thumbnail-yes',
1129 $exists[
'thumbFile']->
getTitle()->getPrefixedText(), $filename );
1130 } elseif ( $exists[
'warning'] ==
'thumb-name' ) {
1132 $name = $file->getName();
1133 $badPart = substr( $name, 0, strpos( $name,
'-' ) + 1 );
1134 $warnMsg =
wfMessage(
'file-thumbnail-no', $badPart );
1135 } elseif ( $exists[
'warning'] ==
'bad-prefix' ) {
1136 $warnMsg =
wfMessage(
'filename-bad-prefix', $exists[
'prefix'] );
1139 return $warnMsg ? $warnMsg->page( $file->getTitle() )->parse() :
'';
1152 $gallery = ImageGalleryBase::factory(
false, $this->
getContext() );
1153 $gallery->setShowBytes(
false );
1154 $gallery->setShowDimensions(
false );
1155 foreach ( $dupes as $file ) {
1156 $gallery->add( $file->getTitle() );
1160 $this->msg(
'file-exists-duplicate' )->numParams( count( $dupes ) )->parse() .
1161 $gallery->toHTML() .
"</li>\n";
1178 return $bitmapHandler->autoRotateEnabled();
1186class_alias( SpecialUpload::class,
'SpecialUpload' );
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
if(!defined('MW_SETUP_CALLBACK'))
Generic handler for bitmap images.
An error page which can definitely be safely rendered using the OutputPage.
Handle enqueueing of background jobs.
Local file in the wiki's own database.
Local repository that stores files in the local filesystem and registers them in the wiki's own datab...
A class containing constants representing the names of configuration variables.
const EnableAsyncUploads
Name constant for the EnableAsyncUploads setting, for use with Config::get()
const ForceUIMsgAsContentMsg
Name constant for the ForceUIMsgAsContentMsg setting, for use with Config::get()
const UseCopyrightUpload
Name constant for the UseCopyrightUpload setting, for use with Config::get()
const FileExtensions
Name constant for the FileExtensions setting, for use with Config::get()
const EnableAsyncUploadsByURL
Name constant for the EnableAsyncUploadsByURL setting, for use with Config::get()
Parent class for all special pages.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
getUser()
Shortcut to get the User executing this instance.
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
getPageTitle( $subpage=false)
Get a self-referential title object.
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
getConfig()
Shortcut to get main config object.
getContext()
Gets the context this SpecialPage is executed in.
getRequest()
Get the WebRequest being used for this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
getContentLanguage()
Shortcut to get content language.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages By default the message key is the canonical name of...
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
Show an error when a user tries to do something they do not have the necessary permissions for.
Prioritized list of file repositories.
UploadBase and subclasses are the backend of MediaWiki's file uploads.
Implements uploading from previously stored file.
Implements uploading from a HTTP resource.
Show an error when the user tries to do something whilst blocked.
Special handling for representing file pages.
if(count( $args)< 1) $job