MDL-66221 tool_recyclebin: Fix recycle bin with activity settings

If backup_auto_activities setting from Automated backup is disabled
the activities will not be stored for the recycle bin
This commit is contained in:
raortegar
2023-01-13 11:30:54 +01:00
parent b8b905cd90
commit afb4a9effd
4 changed files with 36 additions and 1 deletions
@@ -133,6 +133,16 @@ class course_bin extends base_bin {
\backup::MODE_AUTOMATED,
$user->id
);
// When "backup_auto_activities" setting is disabled, activities can't be restored from recycle bin.
$plan = $controller->get_plan();
$activitiessettings = $plan->get_setting('activities');
$settingsvalue = $activitiessettings->get_value();
if (empty($settingsvalue)) {
$controller->destroy();
return;
}
$controller->execute_plan();
// We don't need the forced setting anymore, hence unsetting it.