Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-30792 Files API: maxbytes will be set by get_max_upload_file_size…

… if less then 0 or greater then max moodle limit
  • Loading branch information...
commit 7030756a983960e69abb3feecf387b5ae414d23e 1 parent 470d47f
@rajeshtaneja rajeshtaneja authored
Showing with 8 additions and 5 deletions.
  1. +2 −2 repository/filepicker.php
  2. +6 −3 repository/repository_ajax.php
View
4 repository/filepicker.php
@@ -89,9 +89,9 @@
}
$context = context::instance_by_id($contextid);
-$moodle_maxbytes = get_user_max_upload_file_size($context);
+$moodle_maxbytes = get_user_max_upload_file_size($context, $CFG->maxbytes, $course->maxbytes);
// to prevent maxbytes greater than moodle maxbytes setting
-if ($maxbytes == 0 || $maxbytes>=$moodle_maxbytes) {
+if (($maxbytes <= 0) || ($maxbytes >= $moodle_maxbytes)) {
$maxbytes = $moodle_maxbytes;
}
View
9 repository/repository_ajax.php
@@ -78,10 +78,13 @@
// Check permissions
$repo->check_capability();
-
-$moodle_maxbytes = get_user_max_upload_file_size($context);
+$coursemaxbytes = 0;
+if (!empty($course)) {
+ $coursemaxbytes = $course->maxbytes;
+}
+$moodle_maxbytes = get_user_max_upload_file_size($context, $CFG->maxbytes, $coursemaxbytes);
// to prevent maxbytes greater than moodle maxbytes setting
-if ($maxbytes == 0 || $maxbytes>=$moodle_maxbytes) {
+if (($maxbytes <= 0) || ($maxbytes >= $moodle_maxbytes)) {
$maxbytes = $moodle_maxbytes;
}
Please sign in to comment.
Something went wrong with that request. Please try again.