Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.7.7
-
Component/s: Files API
-
Testing Instructions:
-
Affected Branches:MOODLE_27_STABLE
-
Fixed Branches:MOODLE_33_STABLE, MOODLE_34_STABLE
-
Pull from Repository:
-
Pull Master Branch:wip-
MDL-49995-master -
Pull Master Diff URL:
Description
In some occasions it is possible, that users create orhaned files in moodledata. I found one of them:
- Create a file by mod_resource, make sure you have never used this file in this moodle instance
- Wait, until cron deletes user draft.
- After the deletion of the draft, overwrite the created file by e.g. drag-ad-drop
Since it can take one week for the cron to delete the drafts, you may speed up this by the following steps:
- alter line 2168 from `lib/filestorage/file_storage.php` to `$time = time();` (Moodle 2.7)
- change value `nextruntime` of entry with classname `\core\task\file_trash_cleanup_task` in table `
{task_scheduled}
` to `lastruntime`
- execute /admin/cli/cron.php manually or wait for execution
The code have to be rewinded afterwards, since they have huge impact on the system and usability. I recommend strongly to activate maintenance mode and backup your system!
My Interpretation: Drag-and-drop overwrites the entries contenthash in DB, which leads to the point, that moodle doesn't know of the existence of the file anymore. We have now around 750 orphaned files in our moodle-data. A number, which will increase for sure. Please fix.