diff --git a/backup/backup_scheduled.php b/backup/backup_scheduled.php index 87ab3a1..a3ce24c 100644 --- a/backup/backup_scheduled.php +++ b/backup/backup_scheduled.php @@ -507,7 +507,21 @@ function schedule_backup_course_configure($course,$starttime = 0) { //Call the check function to show more info $modcheckbackup = $modname."_check_backup_mods"; schedule_backup_log($starttime,$course->id," $modname"); - $modcheckbackup($course->id,$$var,$backup_unique_code); + + // Make sure this module exists in preferences before trying to access its instances + if(isset($preferences->mods[$modname])) { + $instances = $preferences->mods[$modname]->instances; + } + + // Take the ID from the key of all the instances and make the ID a property of the instance object + // This makes the instance object properties similar to the format used in manual backup + if(isset($instances)) { + foreach ($instances as $id => $instance) { + $instance->id = $id; + } + } + + $modcheckbackup($course->id,$$var,$backup_unique_code, $instances); } } }