MDL-35773 Backup: API should have option to not backup files

Allow both UI and automated backups to be created without
including files.  Instead include only file references.
This is essentially implementing "SAMESITE" to backup files
instead of only for import and export functionality.
A new backup setting to include files (defaults to yes)
has been included.

The restore process will also look for and attempt to
restore files from the trashdir as part of restoring
backups.  Additionally to support this process the
ammount of time files are kept in trashdir before they
are cleaned up via cron is also adjustable via admin
setting.
This commit is contained in:
Matt Porritt 2018-12-10 12:27:26 +11:00 committed by Mark Nelson
parent f622ee97e3
commit d7e4481e98
17 changed files with 190 additions and 18 deletions

View file

@ -110,6 +110,12 @@ class backup_root_task extends backup_task {
$this->add_setting($blocks);
$this->converter_deps($blocks, $converters);
// Define files.
$files = new backup_generic_setting('files', base_setting::IS_BOOLEAN, true);
$files->set_ui(new backup_setting_ui_checkbox($files, get_string('rootsettingfiles', 'backup')));
$this->add_setting($files);
$this->converter_deps($files, $converters);
// Define filters
$filters = new backup_generic_setting('filters', base_setting::IS_BOOLEAN, true);
$filters->set_ui(new backup_setting_ui_checkbox($filters, get_string('rootsettingfilters', 'backup')));