| Línea 119... |
Línea 119... |
| 119 |
// setting here via $CFG->forced_plugin_settings, so it won't interfere other operations.
|
119 |
// setting here via $CFG->forced_plugin_settings, so it won't interfere other operations.
|
| 120 |
// See MDL-65218 and MDL-35773 for more information.
|
120 |
// See MDL-65218 and MDL-35773 for more information.
|
| 121 |
// This hack will be removed once recycle bin switches to use its own backup mode, with
|
121 |
// This hack will be removed once recycle bin switches to use its own backup mode, with
|
| 122 |
// own preferences and 100% separate from MOODLE_AUTOMATED.
|
122 |
// own preferences and 100% separate from MOODLE_AUTOMATED.
|
| 123 |
// TODO: Remove this as part of MDL-65228.
|
123 |
// TODO: Remove this as part of MDL-65228.
|
| - |
|
124 |
$forcedbackupsettings = $CFG->forced_plugin_settings['backup'] ?? null;
|
| 124 |
$CFG->forced_plugin_settings['backup'] = ['backup_auto_storage' => 0, 'backup_auto_files' => 1];
|
125 |
$CFG->forced_plugin_settings['backup']['backup_auto_storage'] = 0;
|
| - |
|
126 |
$CFG->forced_plugin_settings['backup']['backup_auto_files'] = 1;
|
| Línea 125... |
Línea 127... |
| 125 |
|
127 |
|
| 126 |
// Backup the activity.
|
128 |
// Backup the activity.
|
| 127 |
$user = get_admin();
|
129 |
$user = get_admin();
|
| 128 |
$controller = new \backup_controller(
|
130 |
$controller = new \backup_controller(
|
| Línea 143... |
Línea 145... |
| 143 |
return;
|
145 |
return;
|
| 144 |
}
|
146 |
}
|
| Línea 145... |
Línea 147... |
| 145 |
|
147 |
|
| Línea 146... |
Línea 148... |
| 146 |
$controller->execute_plan();
|
148 |
$controller->execute_plan();
|
| 147 |
|
149 |
|
| 148 |
// We don't need the forced setting anymore, hence unsetting it.
|
150 |
// We don't need the forced setting anymore, hence restore previous settings.
|
| Línea 149... |
Línea 151... |
| 149 |
// TODO: Remove this as part of MDL-65228.
|
151 |
// TODO: Remove this as part of MDL-65228.
|
| 150 |
unset($CFG->forced_plugin_settings['backup']);
|
152 |
$CFG->forced_plugin_settings['backup'] = $forcedbackupsettings;
|
| 151 |
|
153 |
|
| 152 |
// Grab the result.
|
154 |
// Grab the result.
|
| Línea 250... |
Línea 252... |
| 250 |
// so it won't interfere other operations.
|
252 |
// so it won't interfere other operations.
|
| 251 |
// See MDL-65218 and MDL-35773 for more information.
|
253 |
// See MDL-65218 and MDL-35773 for more information.
|
| 252 |
// This hack will be removed once recycle bin switches to use its own backup mode, with
|
254 |
// This hack will be removed once recycle bin switches to use its own backup mode, with
|
| 253 |
// own preferences and 100% separate from MOODLE_AUTOMATED.
|
255 |
// own preferences and 100% separate from MOODLE_AUTOMATED.
|
| 254 |
// TODO: Remove this as part of MDL-65228.
|
256 |
// TODO: Remove this as part of MDL-65228.
|
| - |
|
257 |
$forcedrestoresettings = $CFG->forced_plugin_settings['restore'] ?? null;
|
| - |
|
258 |
$CFG->forced_plugin_settings['restore']['restore_general_users'] = 1;
|
| 255 |
$CFG->forced_plugin_settings['restore'] = ['restore_general_users' => 1, 'restore_general_groups' => 1];
|
259 |
$CFG->forced_plugin_settings['restore']['restore_general_groups'] = 1;
|
| Línea 256... |
Línea 260... |
| 256 |
|
260 |
|
| 257 |
// Define the import.
|
261 |
// Define the import.
|
| 258 |
$controller = new \restore_controller(
|
262 |
$controller = new \restore_controller(
|
| 259 |
$tempdir,
|
263 |
$tempdir,
|
| Línea 282... |
Línea 286... |
| 282 |
}
|
286 |
}
|
| Línea 283... |
Línea 287... |
| 283 |
|
287 |
|
| 284 |
// Run the import.
|
288 |
// Run the import.
|
| Línea 285... |
Línea 289... |
| 285 |
$controller->execute_plan();
|
289 |
$controller->execute_plan();
|
| 286 |
|
290 |
|
| 287 |
// We don't need the forced setting anymore, hence unsetting it.
|
291 |
// We don't need the forced setting anymore, hence restore previous settings.
|
| Línea 288... |
Línea 292... |
| 288 |
// TODO: Remove this as part of MDL-65228.
|
292 |
// TODO: Remove this as part of MDL-65228.
|
| 289 |
unset($CFG->forced_plugin_settings['restore']);
|
293 |
$CFG->forced_plugin_settings['restore'] = $forcedrestoresettings;
|
| Línea 290... |
Línea 294... |
| 290 |
|
294 |
|