From: Raimond Spekking Date: Thu, 27 Mar 2008 18:34:27 +0000 (+0000) Subject: * (bug 13490) Show upload/file size limit on upload form X-Git-Tag: 1.31.0-rc.0~48774 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=73233978a70f7aea7169f82f6ab958963f11ee02;p=lhc%2Fweb%2Fwiklou.git * (bug 13490) Show upload/file size limit on upload form --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e5c6b8f6ff..83544c0df7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -56,7 +56,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 9447) Added hooks for search result headings * Image redirects are now enabled * (bug 13450) Email confirmation can now be canceled before the expiration - +* (bug 13490) Show upload/file size limit on upload form === Bug fixes in 1.13 === diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index b2017bc7ed..3c6d2f61e3 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -890,7 +890,7 @@ class UploadForm { * @access private */ function mainUploadForm( $msg='' ) { - global $wgOut, $wgUser; + global $wgOut, $wgUser, $wgLang, $wgMaxUploadSize; global $wgUseCopyrightUpload, $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview; global $wgRequest, $wgAllowCopyUploads; global $wgStylePath, $wgStyleVersion; @@ -980,6 +980,26 @@ wgUploadAutoFill = {$autofill}; } } + # Get the maximum file size from php.ini as $wgMaxUploadSize works for uploads from URL via CURL only + # See http://de.php.net/manual/en/ini.core.php#ini.upload-max-filesize for possible values of upload_max_filesize + $val = trim( ini_get( 'upload_max_filesize' ) ); + $last = ( substr( $val, -1 ) ); + switch( $last ) { + case 'G': + $val2 = substr( $val, 0, -1 ) * 1024 * 1024 * 1024; + break; + case 'M': + $val2 = substr( $val, 0, -1 ) * 1024 * 1024; + break; + case 'K': + $val2 = substr( $val, 0, -1 ) * 1024; + break; + default: + $val2 = $val; + } + $val2 = $wgAllowCopyUploads ? min( $wgMaxUploadSize, $val2 ) : $val2; + $maxUploadSize = wfMsgExt( 'upload-maxfilesize', 'parseinline', $wgLang->formatSize( $val2 ) ); + $sourcefilename = wfMsgExt( 'sourcefilename', 'escapenoentities' ); $destfilename = wfMsgExt( 'destfilename', 'escapenoentities' ); $summary = wfMsgExt( 'fileuploadsummary', 'parseinline' ); @@ -1057,6 +1077,7 @@ wgUploadAutoFill = {$autofill}; + {$maxUploadSize} {$extensionsList} diff --git a/languages/messages/MessagesDe.php b/languages/messages/MessagesDe.php index e0e474aa3a..983616bbb9 100644 --- a/languages/messages/MessagesDe.php +++ b/languages/messages/MessagesDe.php @@ -1161,6 +1161,7 @@ Bitte prüfe, ob du das Bild in voller Auflösung vorliegen hast und lade dieses 'uploadvirus' => 'Diese Datei enthält einen Virus! Details: $1', 'sourcefilename' => 'Quelldatei:', 'destfilename' => 'Zielname:', +'upload-maxfilesize' => 'Maximale Dateigröße: $1', 'watchthisupload' => 'Diese Seite beobachten', 'filewasdeleted' => 'Eine Datei mit diesem Namen wurde schon einmal hochgeladen und zwischenzeitlich wieder gelöscht. Bitte prüfe zuerst den Eintrag im $1, bevor du die Datei wirklich speicherst.', 'upload-wasdeleted' => "'''Achtung: Du lädst eine Datei hoch, die bereits früher gelöscht wurde.''' diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 4e9c95f95d..ad7f27c166 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1496,6 +1496,7 @@ If you have this image in full resolution upload this one, otherwise change the 'uploadvirus' => 'The file contains a virus! Details: $1', 'sourcefilename' => 'Source filename:', 'destfilename' => 'Destination filename:', +'upload-maxfilesize' => 'Maximum file size: $1', 'watchthisupload' => 'Watch this page', 'filewasdeleted' => 'A file of this name has been previously uploaded and subsequently deleted. You should check the $1 before proceeding to upload it again.', 'upload-wasdeleted' => "'''Warning: You are uploading a file that was previously deleted.''' diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 6e0f40ccb0..e0858246dc 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -906,6 +906,7 @@ $wgMessageStructure = array( 'uploadvirus', 'sourcefilename', 'destfilename', + 'upload-maxfilesize', 'watchthisupload', 'filewasdeleted', 'upload-wasdeleted',