r50706 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50705‎ | r50706 | r50707 >
Date:19:23, 17 May 2009
Author:siebrand
Status:ok (Comments)
Tags:
Comment:
(bug 18411) The upload form now also checks post_max_size (patch contributed by Enukarmers, updated by Stefano Codari)
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/CREDITS
@@ -67,6 +67,7 @@
6868 * Daniel Arnold
6969 * Danny B.
7070 * Derk-Jan Hartman
 71+* Emufarmers
7172 * FunPika
7273 * Happy-melon
7374 * Jeremy Baron
Index: trunk/phase3/includes/specials/SpecialUpload.php
@@ -1047,26 +1047,29 @@
10481048 }
10491049
10501050 # Get the maximum file size from php.ini as $wgMaxUploadSize works for uploads from URL via CURL only
1051 - # See http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize for possible values of upload_max_filesize
1052 - $val = trim( ini_get( 'upload_max_filesize' ) );
1053 - $last = strtoupper( ( substr( $val, -1 ) ) );
1054 - switch( $last ) {
1055 - case 'G':
1056 - $val2 = substr( $val, 0, -1 ) * 1024 * 1024 * 1024;
1057 - break;
1058 - case 'M':
1059 - $val2 = substr( $val, 0, -1 ) * 1024 * 1024;
1060 - break;
1061 - case 'K':
1062 - $val2 = substr( $val, 0, -1 ) * 1024;
1063 - break;
1064 - default:
1065 - $val2 = $val;
 1051+ # See http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes for possible values of upload_max_filesize and post_max_filesize
 1052+ $max_sizes = array();
 1053+ $max_sizes[] = trim( ini_get( 'upload_max_filesize' ) );
 1054+ $max_sizes[] = trim( ini_get( 'post_max_size' ) );
 1055+ foreach( $max_sizes as &$size) {
 1056+ $last = strtoupper( substr( $size, -1 ) );
 1057+ switch( $last ) {
 1058+ case 'G':
 1059+ $size = substr( $size, 0, -1 ) * 1024 * 1024 * 1024;
 1060+ break;
 1061+ case 'M':
 1062+ $size = substr( $size, 0, -1 ) * 1024 * 1024;
 1063+ break;
 1064+ case 'K':
 1065+ $size = substr( $size, 0, -1 ) * 1024;
 1066+ break;
 1067+ }
10661068 }
1067 - $val2 = $wgAllowCopyUploads ? min( $wgMaxUploadSize, $val2 ) : $val2;
 1069+ $val = min( $max_sizes[0], $max_sizes[1] );
 1070+ $val = $wgAllowCopyUploads ? min( $wgMaxUploadSize, $val ) : $val;
10681071 $maxUploadSize = '<div id="mw-upload-maxfilesize">' .
10691072 wfMsgExt( 'upload-maxfilesize', array( 'parseinline', 'escapenoentities' ),
1070 - $wgLang->formatSize( $val2 ) ) .
 1073+ $wgLang->formatSize( $val ) ) .
10711074 "</div>\n";
10721075
10731076 $sourcefilename = wfMsgExt( 'sourcefilename', array( 'parseinline', 'escapenoentities' ) );
Index: trunk/phase3/RELEASE-NOTES
@@ -53,6 +53,7 @@
5454 Mediawiki Namespace, before checking the message files
5555 * (bug 18466) Add note or warning when overruling a move (semi-)protection
5656 * (bug 18342) insertTags works in edit summary box
 57+* (bug 18411) The upload form also checks post_max_size
5758
5859 === Bug fixes in 1.16 ===
5960

Comments

#Comment by Emufarmers (talk | contribs)   21:12, 17 May 2009

*stabs siebrand* <3

#Comment by Siebrand (talk | contribs)   21:46, 17 May 2009

Hmm?

#Comment by Emufarmers (talk | contribs)   02:50, 18 May 2009

"patch contributed by Enukarmers" >_>

#Comment by Siebrand (talk | contribs)   06:26, 18 May 2009

Ah, yes. I guess that was more important than the correct spelling in CREDITS and the actual application of the patch. Any more open bugs you wold like me to help you out with, because this way it feels like fun.

#Comment by Emufarmers (talk | contribs)   09:37, 18 May 2009

Well, that's why you got <3 with your stabs. :D

Status & tagging log