Permalink
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...
1 parent f2ddce9 commit fa7a8a9899777c55ada9ead587bb6e556f07968b @rajeshtaneja rajeshtaneja committed Aug 3, 2012
Showing with 8 additions and 4 deletions.
  1. +2 −2 repository/filepicker.php
  2. +6 −2 repository/repository_ajax.php
View
4 repository/filepicker.php
@@ -93,9 +93,9 @@
}
}
-$moodle_maxbytes = get_max_upload_file_size();
+$moodle_maxbytes = get_max_upload_file_size($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
8 repository/repository_ajax.php
@@ -83,9 +83,13 @@
/// Check permissions
repository::check_capability($contextid, $repository);
-$moodle_maxbytes = get_max_upload_file_size();
+$coursemaxbytes = 0;
+if (!empty($course)) {
+ $coursemaxbytes = $course->maxbytes;
+}
+$moodle_maxbytes = get_max_upload_file_size($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;
}

0 comments on commit fa7a8a9

Please sign in to comment.