moodle/backup/restore_precheck.html

48 lines
1.3 KiB
HTML
Raw Normal View History

2004-09-12 01:34:24 +00:00
<?php // $Id$
//This page copies th zip to the temp directory,
//unzip it, check that it is a valid backup file
//inform about its contents and fill all the necesary
//variables to continue with the restore.
//Checks we have the file variable
if (!isset($file)) {
error ("File not specified");
}
//Check login
require_login();
2003-05-22 22:12:32 +00:00
//Check admin
if (!empty($id)) {
2003-08-16 06:37:06 +00:00
if (!isteacheredit($id)) {
if (empty($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
} else {
if (!isteacheredit($to)) {
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
}
}
}
} else {
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!");
}
$errorstr = '';
if (!empty($SESSION->restore->importing)) {
define('RESTORE_SILENTLY',true);
}
$status = restore_precheck($id,$file,$errorstr);
if (!$status) {
error("An error occured");
2003-05-17 17:34:30 +00:00
}
?>