moodle/backup/restore.php

94 lines
2.9 KiB
PHP
Raw Normal View History

<?PHP //$Id$
2003-05-17 08:56:53 +00:00
//This script is used to configure and execute the restore proccess.
//Define some globals for all the script
//Units used
require_once ("../config.php");
require_once ("../lib/xmlize.php");
require_once ("../course/lib.php");
require_once ("lib.php");
require_once ("restorelib.php");
//Optional
optional_variable($file);
//Check login
require_login();
//Check admin
if (!isadmin()) {
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!");
}
//Check necessary functions exists. Thanks to gregb@crowncollege.edu
backup_required_functions();
//Check backup_version
if ($file) {
$linkto = "restore.php?file=".$file;
} else {
$linkto = "restore.php";
}
upgrade_backup_db($linkto);
//Get strings
$strcourserestore = get_string("courserestore");
$stradministration = get_string("administration");
//If no file has been selected from the FileManager, inform and end
if (!$file) {
print_header("$site->shortname: $strcourserestore", $site->fullname,
"<A HREF=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</A> -> $strcourserestore");
print_heading(get_string("nofilesselected"));
print_continue("$CFG->wwwroot/$CFG->admin/index.php");
print_footer();
exit;
}
//If cancel has been selected, inform and end
if ($cancel) {
print_header("$site->shortname: $strcourserestore", $site->fullname,
"<A HREF=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</A> -> $strcourserestore");
print_heading(get_string("restorecancelled"));
print_continue("$CFG->wwwroot/$CFG->admin/index.php");
print_footer();
exit;
}
//We are here, so me have a file.
//Print header
print_header("$site->shortname: $strcourserestore", $site->fullname,
"<A HREF=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</A> ->
$strcourserestore -> ".basename($file));
//Print form
print_heading("$strcourserestore: ".basename($file));
print_simple_box_start("center", "", "$THEME->cellheading");
//Adjust some php variables to the execution of this script
ini_set("max_execution_time","3000");
ini_set("memory_limit","56M");
//Call the form, depending the step we are
if (!$launch) {
include_once("restore_precheck.html");
} else if ($launch == "form") {
include_once("restore_form.html");
2003-05-19 22:28:39 +00:00
} else if ($launch == "check") {
include_once("restore_check.html");
} else if ($launch == "execute") {
include_once("restore_execute.html");
}
print_simple_box_end();
//Print footer
print_footer();
?>