mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 11:46:19 +01:00
MDL-30792 Files API: maxbytes will be set by get_max_upload_file_size if less then 0 or greater then max moodle limit
This commit is contained in:
parent
470d47f512
commit
7030756a98
@ -89,9 +89,9 @@ if ($repo_id) {
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
@ -78,10 +78,13 @@ $repo = repository::get_repository_by_id($repo_id, $contextid, $repooptions);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user