info; $course_header = $SESSION->course_header; $restore = $SESSION->restore; } //Add info->original_wwwroot to $restore to be able to use it in all the restore process //(mainly when decoding internal links) $restore->original_wwwroot = $info->original_wwwroot; //Add info->backup_version to $restore to be able to detect versions in the restore process //(to decide when to convert wiki texts to markdown...) $restore->backup_version = $info->backup_backup_version; //Check login require_login(); //Check admin //moodle/site:restore if (!empty($id)) { if (!has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $id))) { if (!has_capability('mod/resource:copyresource', get_context_instance(CONTEXT_COURSE, $id))){ if (empty($to)) { error("You need to be a teacher or admin user to use this page_9.to=".$to."id=".$id, "$CFG->wwwroot/login/index.php"); } else { if (!has_capability('mod/resource:copyresource', get_context_instance(CONTEXT_COURSE, $id))) { error("You need to be a teacher or admin user to use this page_10.", "$CFG->wwwroot/login/index.php"); } } } } } else { if (!has_capability('mod/resource:copyresource', get_context_instance(CONTEXT_SYSTEM, SITEID))) { error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php"); } } //Check site if (!$site = get_site()) { error("Site not found!"); } $errorstr = ''; $status = restore_execute_2($restore,$info,$course_header,$errorstr); if (!$status) { error ("An error has occurred and the restore could not be completed!"); //copyresource zip delete } else { unlink($file); } if (empty($restore->importing)) { //Print final message print_simple_box(get_string("restorefinished"),"center"); } else { print_simple_box(get_string("importdatafinished"),"center"); unset($SESSION->restore); } print_continue("$CFG->wwwroot/course/view.php?id=".$restore->course_id); ?>