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