MDL-37761 Backup: Do not include files in backups when importing courses/activities

When we import courses or duplicate activities, the deduplicating nature of
the file_storage system means that we don't actually have to include the
real files in the backup - just their metadata from the file table.

The restoration process needs to know not to expect files from the backup
phase so a flag is set in moodle_backup metadata.
This commit is contained in:
Andrew Nicols 2013-05-12 16:53:57 +01:00
parent f1454424b5
commit b1850c12c1
8 changed files with 168 additions and 46 deletions

View file

@ -61,6 +61,11 @@ class backup_file_manager {
public static function copy_file_moodle2backup($backupid, $filerecorid) {
global $DB;
if (!backup_controller_dbops::backup_includes_files($backupid)) {
// Only include the files if required by the controller.
return;
}
// Normalise param
if (!is_object($filerecorid)) {
$filerecorid = $DB->get_record('files', array('id' => $filerecorid));