-
Bug
-
Resolution: Fixed
-
Minor
-
2.9.2, 2.9.5, 3.0.3, 3.1.3, 3.4
-
MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE, MOODLE_34_STABLE
-
MOODLE_33_STABLE, MOODLE_34_STABLE
-
wip-
MDL-52100-master -
Reproduction steps
- As the admin change the site maxbytes setting (Site administration > Security > Site policies) Maximum uploaded file size to something low.
- Create a folder resource. Add a folder to the filepicker. Add some large files as the administrator.
- Log in as a teacher (editingteacher) and edit the folder resource. Only change the name of the folder. Don't change the files.
- Observe that the large files are now gone.
The following line checks to see if the file size is larger than the max bytes for that user and if it is then the new hash is not created, hence the existing files are removed. https://github.com/moodle/moodle/blob/master/lib/filelib.php#L915
Problem description:
Big files (bigger than maxbytes defined) are deleted on a "visible" folder when an editingteachers role save the resource.
We upload into a "mod_folder" resource 2 files bigger than platform limit (u can increase / decrease limit for upload with teacher role), and as editingteacher role (no admin) edit folder and save them, all files bigger than maxsize variable disappear of the folder. If we do the same process as admin, no delete files.
Environment:
- Moodle 2.9.5 and 3.0.3 (also ocurred in previous versions).
- Linux RHEL
- PHP 5.5.21
- Postgres 9.3.4
- Moodle maxbytes variable: 5MB