-
Improvement
-
Resolution: Fixed
-
Minor
-
4.1.4
-
MOODLE_401_STABLE
-
MOODLE_404_STABLE
-
mdl-79151-master
-
To reproduce
- Define a textarea custom field for use with courses.
- Create a course.
- Fill in some text for the custom field, along with an uploaded image.
- Backup the course
- Delete the course entirely.
- Restore the course.
- Check the custom field, notice the missing image.
An examination of the backup files should also reveal no files were saved.
I found a deeper problem with custom fields in that they do not handle backup/restore properly.
Because developers are able to create and add new custom fields, each custom field is a black box. We do not know the nature of the data within. It could contain files. We would have no way of knowing the metadata about those files. It could contain more exotic data that can not be anticipated.
Because of this, the custom field infrastructure (i.e. the data controller classes) needs methods to handle backup and restore.