displays incorrect tabs
* (bug 23190) Improved math representation for text browsers.
* (bug 22015) Improved upload-by-url error handling and error display
+* (bug 17941) $wgMaxUploadSize is now honored by all upload sources
=== API changes in 1.17 ===
* (bug 22738) Allow filtering by action type on query=logevent
case UploadBase::EMPTY_FILE:
$this->dieUsage( 'The file you submitted was empty', 'empty-file' );
break;
+ case UploadBase::FILE_TOO_LARGE:
+ $this->dieUsage( 'The file you submitted was too large', 'file-too-large' );
+ break;
case UploadBase::FILETYPE_MISSING:
$this->dieUsage( 'The file is missing an extension', 'filetype-missing' );
break;
/**
* Show the upload form with error message, but do not stash the file.
*
- * @param $message String
+ * @param $message HTML string
*/
protected function showUploadError( $message ) {
$message = '<h2>' . wfMsgHtml( 'uploadwarning' ) . "</h2>\n" .
/** Statuses that require reuploading **/
case UploadBase::EMPTY_FILE:
- $this->showUploadForm( $this->getUploadForm( wfMsgHtml( 'emptyfile' ) ) );
+ $this->showUploadError( wfMsgHtml( 'emptyfile' ) );
+ break;
+ case UploadBase::FILESIZE_TOO_LARGE:
+ $this->showUploadError( wfMsgHtml( 'largefileserver' ) );
break;
case UploadBase::FILETYPE_BADTYPE:
$finalExt = $details['finalExt'];
*/
protected function getSourceSection() {
global $wgLang, $wgUser, $wgRequest;
+ global $wgMaxUploadSize;
if ( $this->mSessionKey ) {
return array(
'help' => wfMsgExt( 'upload-maxfilesize',
array( 'parseinline', 'escapenoentities' ),
$wgLang->formatSize(
- wfShorthandToInteger( ini_get( 'upload_max_filesize' ) )
+ wfShorthandToInteger( min(
+ wfShorthandToInteger(
+ ini_get( 'upload_max_filesize' )
+ ), $wgMaxUploadSize
+ ) )
)
) . ' ' . wfMsgHtml( 'upload_source_file' ),
'checked' => $selectedSourceType == 'file',
);
if ( $canUploadByUrl ) {
- global $wgMaxUploadSize;
$descriptor['UploadFileURL'] = array(
'class' => 'UploadSourceField',
'section' => 'source',
const FILETYPE_MISSING = 8;
const FILETYPE_BADTYPE = 9;
const VERIFICATION_ERROR = 10;
+ # HOOK_ABORTED is the new name of UPLOAD_VERIFICATION_ERROR
const UPLOAD_VERIFICATION_ERROR = 11;
const HOOK_ABORTED = 11;
+ const FILE_TOO_LARGE = 12;
const SESSION_VERSION = 2;
const SESSION_KEYNAME = 'wsUploadData';
if( $this->isEmptyFile() ) {
return array( 'status' => self::EMPTY_FILE );
}
+
+ /**
+ * Honor $wgMaxUploadSize
+ */
+ global $wgMaxUploadSize;
+ if( $this->mFileSize > $wgMaxUploadSize ) {
+ return array( 'status' => self::FILE_TOO_LARGE );
+ }
/**
* Look at the contents of the file; if we can recognize the
fclose( $this->mCurlDestHandle );
unset( $this->mCurlDestHandle );
+ global $wgMaxUploadSize;
+ if ( $this->mFileSize > $wgMaxUploadSize ) {
+ # Just return an ok, so that the regular verifications can handle
+ # the file-too-large error
+ return Status::newGood();
+ }
+
return $status;
}