moodle/backup/try.php
stronk7 1b225eaf65 Wow !!
Now backup of one course is ENTIRELY encapsulated inside backup_scheduled.php.
And a backup of EVERY course can be executed invoking try.php.
Backing up to a custom directory is working too !!
They are preliminary versions, of course, but seem to work fine :-)
Now I'm going to make all the necessay structures to support the cron system
and to be able to inform the admin about every scheduled backup process.
Ciao :-)
2003-12-01 22:00:00 +00:00

43 lines
1.2 KiB
PHP

<?php
require_once ("../config.php");
require_once ("backup_scheduled.php");
require_once ("lib.php");
require_once ("backuplib.php");
require_login();
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();
//Adjust some php variables to the execution of this script
ini_set("max_execution_time","3000");
ini_set("memory_limit","56M");
echo "<pre>\n";
$status = true;
$courses = get_records("course");
foreach ($courses as $course) {
echo "Start course ".$course->fullname;
$preferences = schedule_backup_course_configure($course);
if ($preferences && $status) {
$status = schedule_backup_course_execute($preferences);
}
if ($status && $preferences) {
echo "End course ".$course->fullname." OK\n\n";
} else {
echo "End course ".$course->fullname." FAIL\n\n";
}
}
?>