Commit 4503a050 authored by Son Nguyen's avatar Son Nguyen Committed by Robert Lyon

Take into account the mahara setting 'maxuploadsize'. Bug 1495676

behatnotneeded

Change-Id: Icca153ae8d4728ff840bc088d719affb3b80a68f
parent 824c1dbb
...@@ -607,3 +607,12 @@ $cfg->probationenabled = false; ...@@ -607,3 +607,12 @@ $cfg->probationenabled = false;
* many probation points new users will start with. * many probation points new users will start with.
*/ */
$cfg->probationstartingpoints = 2; $cfg->probationstartingpoints = 2;
/**
* @global string $cfg->maxuploadsize The maximun upload size in bytes
* This allow to limit the upload size
* The real maximum upload size will be calculated on
* - PHP settings: post_max_size and upload_max_filesize
* - this setting $cfg->maxuploadsize if set
*/
//$cfg->maxuploadsize = 16777216;
...@@ -2663,6 +2663,9 @@ function get_max_upload_size($is_user) { ...@@ -2663,6 +2663,9 @@ function get_max_upload_size($is_user) {
else { else {
$maxuploadsize = max(1024, min($postmaxsize - 4096, get_real_size(ini_get('upload_max_filesize')))); $maxuploadsize = max(1024, min($postmaxsize - 4096, get_real_size(ini_get('upload_max_filesize'))));
} }
if (get_config('maxuploadsize')) {
$maxuploadsize = min($maxuploadsize, get_config('maxuploadsize'));
}
if ($is_user) { if ($is_user) {
$userquotaremaining = $USER->get('quota') - $USER->get('quotaused'); $userquotaremaining = $USER->get('quota') - $USER->get('quotaused');
$maxuploadsize = min($maxuploadsize, $userquotaremaining); $maxuploadsize = min($maxuploadsize, $userquotaremaining);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment