mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-30792 Files API: Cleaner approach to get maxbytes size in filepicker
This commit is contained in:
parent
7030756a98
commit
960f437972
3 changed files with 9 additions and 13 deletions
|
@ -78,15 +78,13 @@ $repo = repository::get_repository_by_id($repo_id, $contextid, $repooptions);
|
|||
|
||||
// Check permissions
|
||||
$repo->check_capability();
|
||||
|
||||
$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)) {
|
||||
$maxbytes = $moodle_maxbytes;
|
||||
}
|
||||
// Make sure maxbytes passed is within site filesize limits.
|
||||
$maxbytes = get_user_max_upload_file_size($context, $CFG->maxbytes, $coursemaxbytes, $maxbytes);
|
||||
|
||||
// Wait as long as it takes for this script to finish
|
||||
set_time_limit(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue