-
Bug
-
Resolution: Fixed
-
Minor
-
3.1, 3.4.3, 3.5
-
MOODLE_31_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
-
MOODLE_34_STABLE, MOODLE_35_STABLE
-
MDL-54830-master -
Easy
-
Description
By default, maxbytes value in database mdl_course is set to 0 (zero) meaning to use the site upload limit (dynamically).
But when I call "core_course_update_courses" & pass maxbytes value as 0 (zero). WS is updating the database with calculated bytes value of the current site upload limit instead of updating as zero.
Impact - affected course does not dynamically use the site upload limit if changed in future
To replicate:
- Set up a web service (https://docs.moodle.org/35/en/Using_web_services#Creating_a_service) with core_course_updated_courses and a token for the admin user.
- Make sure your php config has the post_max_size and upload_max_filesize both set to 8M
- Set "Maximum uploaded file size" (maxbytes) to 2MB for the Moodle install via admin
- Now, create a new course and save.
- Check the "Files and uploads" settings for the course and verify it's set to "site upload limit (2M)"
- Try to upload a 3M file to the course home (drag and drop) and verify it fails. Normal, as we've got a 2M limit right now.
- Now, run the webservice call:
curl 'http://localhost/master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_course_update_courses&wstoken=TOKEN&courses[0][id]=COURSEID&courses[0][maxbytes]=0' | python -m "json.tool"
swapping in your token and courseid as needed.
- Check the course settings and notice that maxbytes is now set to 2M, not the site limit as before.
- Check the mdl_course table and notice that maxbytes has been set to 2097152, not 0!
- Now, change the "Maximum uploaded file size" (maxbytes) to 5MB for the Moodle install via admin again.
- Check the course settings again, and notice the maxbytes is still set to 2M.