Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 115... Línea 115...
115
        // setting here via $CFG->forced_plugin_settings, so it won't interfere other operations.
115
        // setting here via $CFG->forced_plugin_settings, so it won't interfere other operations.
116
        // See MDL-65218 and MDL-35773 for more information.
116
        // See MDL-65218 and MDL-35773 for more information.
117
        // This hack will be removed once recycle bin switches to use its own backup mode, with
117
        // This hack will be removed once recycle bin switches to use its own backup mode, with
118
        // own preferences and 100% separate from MOODLE_AUTOMATED.
118
        // own preferences and 100% separate from MOODLE_AUTOMATED.
119
        // TODO: Remove this as part of MDL-65228.
119
        // TODO: Remove this as part of MDL-65228.
-
 
120
        $forcedbackupsettings = $CFG->forced_plugin_settings['backup'] ?? null;
120
        $CFG->forced_plugin_settings['backup'] = ['backup_auto_storage' => 0, 'backup_auto_files' => 1];
121
        $CFG->forced_plugin_settings['backup']['backup_auto_storage'] = 0;
-
 
122
        $CFG->forced_plugin_settings['backup']['backup_auto_files'] = 1;
Línea 121... Línea 123...
121
 
123
 
122
        // Backup the course.
124
        // Backup the course.
123
        $user = get_admin();
125
        $user = get_admin();
124
        $controller = new \backup_controller(
126
        $controller = new \backup_controller(
Línea 129... Línea 131...
129
            \backup::MODE_AUTOMATED,
131
            \backup::MODE_AUTOMATED,
130
            $user->id
132
            $user->id
131
        );
133
        );
132
        $controller->execute_plan();
134
        $controller->execute_plan();
Línea 133... Línea 135...
133
 
135
 
134
        // We don't need the forced setting anymore, hence unsetting it.
136
        // We don't need the forced setting anymore, hence restore previous settings.
135
        // TODO: Remove this as part of MDL-65228.
137
        // TODO: Remove this as part of MDL-65228.
Línea 136... Línea 138...
136
        unset($CFG->forced_plugin_settings['backup']);
138
        $CFG->forced_plugin_settings['backup'] = $forcedbackupsettings;
137
 
139
 
138
        // Grab the result.
140
        // Grab the result.
139
        $result = $controller->get_results();
141
        $result = $controller->get_results();
Línea 249... Línea 251...
249
        // so it won't interfere other operations.
251
        // so it won't interfere other operations.
250
        // See MDL-65218 and MDL-35773 for more information.
252
        // See MDL-65218 and MDL-35773 for more information.
251
        // This hack will be removed once recycle bin switches to use its own backup mode, with
253
        // This hack will be removed once recycle bin switches to use its own backup mode, with
252
        // own preferences and 100% separate from MOODLE_AUTOMATED.
254
        // own preferences and 100% separate from MOODLE_AUTOMATED.
253
        // TODO: Remove this as part of MDL-65228.
255
        // TODO: Remove this as part of MDL-65228.
-
 
256
        $forcedrestoresettings = $CFG->forced_plugin_settings['restore'] ?? null;
-
 
257
        $CFG->forced_plugin_settings['restore']['restore_general_users'] = 1;
254
        $CFG->forced_plugin_settings['restore'] = ['restore_general_users' => 1, 'restore_general_groups' => 1];
258
        $CFG->forced_plugin_settings['restore']['restore_general_groups'] = 1;
Línea 255... Línea 259...
255
 
259
 
256
        // Define the import.
260
        // Define the import.
257
        $controller = new \restore_controller(
261
        $controller = new \restore_controller(
258
            $tempdir,
262
            $tempdir,
Línea 285... Línea 289...
285
        }
289
        }
Línea 286... Línea 290...
286
 
290
 
287
        // Run the import.
291
        // Run the import.
Línea 288... Línea 292...
288
        $controller->execute_plan();
292
        $controller->execute_plan();
289
 
293
 
290
        // We don't need the forced setting anymore, hence unsetting it.
294
        // We don't need the forced setting anymore, hence restore previous settings.
Línea 291... Línea 295...
291
        // TODO: Remove this as part of MDL-65228.
295
        // TODO: Remove this as part of MDL-65228.
292
        unset($CFG->forced_plugin_settings['restore']);
296
        $CFG->forced_plugin_settings['restore'] = $forcedrestoresettings;
Línea 293... Línea 297...
293
 
297