mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-25432 backup: Catching exception for orphan course modules and it's block (if any), and logging them, no exception will be thrown for this now.
This commit is contained in:
parent
0dde394db5
commit
5f1f726e68
@ -123,12 +123,23 @@ abstract class backup_plan_builder {
|
||||
|
||||
// Add the activity task, responsible for outputting
|
||||
// all the module related information
|
||||
$plan->add_task(backup_factory::get_backup_activity_task($controller->get_format(), $id));
|
||||
try {
|
||||
$plan->add_task(backup_factory::get_backup_activity_task($controller->get_format(), $id));
|
||||
|
||||
// For the given activity, add as many block tasks as necessary
|
||||
$blockids = backup_plan_dbops::get_blockids_from_moduleid($id);
|
||||
foreach ($blockids as $blockid) {
|
||||
$plan->add_task(backup_factory::get_backup_block_task($controller->get_format(), $blockid, $id));
|
||||
// For the given activity, add as many block tasks as necessary
|
||||
$blockids = backup_plan_dbops::get_blockids_from_moduleid($id);
|
||||
foreach ($blockids as $blockid) {
|
||||
try {
|
||||
$plan->add_task(backup_factory::get_backup_block_task($controller->get_format(), $blockid, $id));
|
||||
} catch (backup_task_exception $e) {
|
||||
$a = stdClass();
|
||||
$a->mid = $id;
|
||||
$a->bid = $blockid;
|
||||
$controller->log(get_string('error_block_for_module_not_found', 'backup', $a), backup::LOG_WARNING);
|
||||
}
|
||||
}
|
||||
} catch (backup_task_exception $e) {
|
||||
$controller->log(get_string('error_course_module_not_found', 'backup', $id), backup::LOG_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,6 +106,8 @@ $string['currentstage8'] = 'Perform backup';
|
||||
$string['currentstage16'] = 'Complete';
|
||||
$string['dependenciesenforced'] = 'Your settings have been altered due to unmet dependencies';
|
||||
$string['enterasearch'] = 'Enter a search';
|
||||
$string['error_block_for_module_not_found'] = 'Orphan block instance (id: {$a->bid}) for course module (id: {$a->mid}) found. This block will not be backed up';
|
||||
$string['error_course_module_not_found'] = 'Orphan course module (id: {$a}) found. This module will not be backed up.';
|
||||
$string['errorfilenamerequired'] = 'You must enter a valid filename for this backup';
|
||||
$string['errorfilenamemustbezip'] = 'The filename you enter must be a ZIP file and have the .mbz extension';
|
||||
$string['errorminbackup20version'] = 'This backup file has been created with one development version of Moodle backup ({$a->backup}). Minimum required is {$a->min}. Cannot be restored.';
|
||||
|
Loading…
x
Reference in New Issue
Block a user