MDL-44626 files: Show the PHP max upload size instead of 'unlimited'
Even when a user has the appropriate capability to upload any sized files, they are still restricted to the PHP post_max_size, and upload_max_filesize values. Rather than showing a value of "Unlimited', we should always restrict to this value.
This commit is contained in:
+1
-1
@@ -6153,7 +6153,7 @@ function get_user_max_upload_file_size($context, $sitebytes = 0, $coursebytes =
|
||||
}
|
||||
|
||||
if (has_capability('moodle/course:ignorefilesizelimits', $context, $user)) {
|
||||
return USER_CAN_IGNORE_FILE_SIZE_LIMITS;
|
||||
return get_max_upload_file_size(USER_CAN_IGNORE_FILE_SIZE_LIMITS);
|
||||
}
|
||||
|
||||
return get_max_upload_file_size($sitebytes, $coursebytes, $modulebytes);
|
||||
|
||||
@@ -144,7 +144,9 @@ class core_webservice_externallib_testcase extends externallib_advanced_testcase
|
||||
$siteinfo = external_api::clean_returnvalue(core_webservice_external::get_site_info_returns(), $siteinfo);
|
||||
|
||||
$this->assertEquals(0, $siteinfo['userquota']);
|
||||
$this->assertEquals(USER_CAN_IGNORE_FILE_SIZE_LIMITS, $siteinfo['usermaxuploadfilesize']);
|
||||
|
||||
// The max_size is dependant upon the post_max_size, and upload_max_filesize values in php.ini.
|
||||
$this->assertEquals(get_max_upload_file_size(USER_CAN_IGNORE_FILE_SIZE_LIMITS), $siteinfo['usermaxuploadfilesize']);
|
||||
$this->assertEquals(true, $siteinfo['usercanmanageownfiles']);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user