Slightly more helpful message if no courses can be shown.
[moodle-linuxchix.git] / backup / try.php
blob01e025a47d64d92fb68642a95e24fb4aff183f41
1 <?PHP //$Id$
2 require_once ("../config.php");
3 require_once ("backup_scheduled.php");
4 require_once ("lib.php");
5 require_once ("backuplib.php");
6 require_once ("$CFG->libdir/blocklib.php");
8 require_login();
10 require_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID));
12 //Check site
13 if (!$site = get_site()) {
14 error("Site not found!");
17 //Check necessary functions exists. Thanks to gregb@crowncollege.edu
18 backup_required_functions();
20 //Adjust some php variables to the execution of this script
21 @ini_set("max_execution_time","3000");
22 raise_memory_limit("192M");
24 echo "<pre>\n";
26 $status = true;
28 $courses = get_records("course");
29 foreach ($courses as $course) {
30 echo "Start course ".$course->fullname;
31 $preferences = schedule_backup_course_configure($course);
32 if ($preferences && $status) {
33 $status = schedule_backup_course_execute($preferences);
35 if ($status && $preferences) {
36 echo "End course ".$course->fullname." OK\n\n";
37 } else {
38 echo "End course ".$course->fullname." FAIL\n\n";