From 5520fc95262b8769ab0645f79b64a153c9cfab0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Sat, 27 Apr 2013 16:00:59 +0200 Subject: [PATCH] MDL-39077 fix regression in previous commit, the limit should be always included in maxbytes --- lib/moodlelib.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 3b36a774d58..6b2076ec34b 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -6225,7 +6225,6 @@ function get_max_upload_sizes($sitebytes = 0, $coursebytes = 0, $modulebytes = 0 } } - krsort($filesize, SORT_NUMERIC); $limitlevel = ''; $displaysize = ''; if ($modulebytes && @@ -6233,14 +6232,20 @@ function get_max_upload_sizes($sitebytes = 0, $coursebytes = 0, $modulebytes = 0 ($modulebytes < $sitebytes || $sitebytes == 0))) { $limitlevel = get_string('activity', 'core'); $displaysize = display_size($modulebytes); + $filesize[$modulebytes] = $displaysize; // Make sure the limit is also included in the list. + } else if ($coursebytes && ($coursebytes < $sitebytes || $sitebytes == 0)) { $limitlevel = get_string('course', 'core'); $displaysize = display_size($coursebytes); + $filesize[$coursebytes] = $displaysize; // Make sure the limit is also included in the list. + } else if ($sitebytes) { $limitlevel = get_string('site', 'core'); $displaysize = display_size($sitebytes); + $filesize[$sitebytes] = $displaysize; // Make sure the limit is also included in the list. } + krsort($filesize, SORT_NUMERIC); if ($limitlevel) { $params = (object) array('contextname'=>$limitlevel, 'displaysize'=>$displaysize); $filesize = array('0'=>get_string('uploadlimitwithsize', 'core', $params)) + $filesize;