$restore = restore_ui::engage_independent_stage($stage / 2, $contextid); if ($restore->process()) { $rc = new restore_controller($restore->get_filepath(), $restore->get_course_id(), backup::INTERACTIVE_YES, backup::MODE_GENERAL, $USER->id, $restore->get_target()); } } if ($rc) { // check if the format conversion must happen first if ($rc->get_status() == backup::STATUS_REQUIRE_CONV) { $rc->convert(); } $restore = new restore_ui($rc, array('contextid' => $context->id)); } } $outcome = $restore->process(); if (!$restore->is_independent()) { if ($restore->get_stage() == restore_ui::STAGE_PROCESS && !$restore->requires_substage()) { try { $restore->execute(); } catch (Exception $e) { $restore->cleanup(); throw $e; } } else { $restore->save_controller(); } } $heading = $course->fullname; $PAGE->set_title($heading . ': ' . $restore->get_stage_name()); $PAGE->set_heading($heading); $PAGE->navbar->add($restore->get_stage_name()); $renderer = $PAGE->get_renderer('core', 'backup');