MDL-30792 Files API: Cleaner approach to get maxbytes size in filepicker

This commit is contained in:
Rajesh Taneja 2012-08-03 11:20:55 +08:00
parent 7030756a98
commit 960f437972
3 changed files with 9 additions and 13 deletions

View file

@ -89,11 +89,9 @@ if ($repo_id) {
}
$context = context::instance_by_id($contextid);
$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)) {
$maxbytes = $moodle_maxbytes;
}
// Make sure maxbytes passed is within site filesize limits.
$maxbytes = get_user_max_upload_file_size($context, $CFG->maxbytes, $course->maxbytes, $maxbytes);
$params = array('ctx_id' => $contextid, 'itemid' => $itemid, 'env' => $env, 'course'=>$courseid, 'maxbytes'=>$maxbytes, 'maxfiles'=>$maxfiles, 'subdirs'=>$subdirs, 'sesskey'=>sesskey());
$params['action'] = 'browse';