portfolio & data MDL-21032 add leap2a to database module
[moodle.git] / backup / try.php
CommitLineData
795b6945 1<?PHP
1b225eaf 2 require_once ("../config.php");
3 require_once ("backup_scheduled.php");
4 require_once ("lib.php");
5 require_once ("backuplib.php");
6
7 require_login();
8
d2940003 9 require_capability('moodle/restore:restorecourse', get_context_instance(CONTEXT_SYSTEM));
1b225eaf 10
2a250a0b 11 $site = get_site();
1b225eaf 12
13 //Check necessary functions exists. Thanks to gregb@crowncollege.edu
14 backup_required_functions();
15
16 //Adjust some php variables to the execution of this script
f74fd818 17 @ini_set("max_execution_time","3000");
1ed8e660 18 if (empty($CFG->extramemorylimit)) {
7022dd39 19 raise_memory_limit('128M');
20 } else {
1ed8e660 21 raise_memory_limit($CFG->extramemorylimit);
7022dd39 22 }
1b225eaf 23
24 echo "<pre>\n";
25
26 $status = true;
27
ad4375ac 28 $courses = $DB->get_records("course");
1b225eaf 29 foreach ($courses as $course) {
6ba65fa0 30 echo "Start course ". format_string($course->fullname);
1b225eaf 31 $preferences = schedule_backup_course_configure($course);
32 if ($preferences && $status) {
33 $status = schedule_backup_course_execute($preferences);
34 }
35 if ($status && $preferences) {
6ba65fa0 36 echo "End course ". format_string($course->fullname)." OK\n\n";
1b225eaf 37 } else {
6ba65fa0 38 echo "End course ". format_string($course->fullname)." FAIL\n\n";
1b225eaf 39 }
40 }