Permalink
Browse files

Now courses are deleted from backup_courses when they have been

deleted from Moodle. See:
http://moodle.org/mod/forum/discuss.php?d=13633

Merged from MOODLE_14_STABLE
  • Loading branch information...
stronk7
stronk7 committed Nov 4, 2004
1 parent ed3d2f4 commit 0a23fdb759afeea6faedd4f40fa9087a45f86a9a
Showing with 16 additions and 0 deletions.
  1. +16 −0 backup/backup_scheduled.php
@@ -63,6 +63,22 @@ function schedule_backup_cron() {
//Now we get a list of courses in the server
if ($status) {
mtrace(" Checking courses");
//First of all, we delete everything from backup tables related to deleted courses
mtrace(" Skipping deleted courses");
$skipped = 0;
if ($bckcourses = get_records('backup_courses')) {
foreach($bckcourses as $bckcourse) {
//Search if it exists
if (!$exists = get_record('course', 'id', "$bckcourse->courseid")) {
//Doesn't exist, so delete from backup tables
delete_records('backup_courses', 'courseid', "$bckcourse->courseid");
delete_records('backup_log', 'courseid', "$bckcourse->courseid");
$skipped++;
}
}
}
mtrace(" $skipped courses");
//Now process existing courses
$courses = get_records("course");
//For each course, we check (insert, update) the backup_course table
//with needed data

0 comments on commit 0a23fdb

Please sign in to comment.