2 //This page copies th zip to the temp directory,
3 //unzip it, check that it is a valid backup file
4 //inform about its contents and fill all the necesary
5 //variables to continue with the restore.
7 //Checks we have the file variable
9 error ("File not specified");
17 if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE
, $id))) {
19 error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
21 if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE
, $to))
22 && !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE
, $to))) {
23 error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
28 if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM
))) {
29 error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
34 if (!$site = get_site()) {
35 error("Site not found!");
39 if (!empty($SESSION->restore
->importing
)) {
40 define('RESTORE_SILENTLY',true);
42 $status = restore_precheck($id,$file,$errorstr);
45 error("An error occured");