1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-14 13:02:07 +02:00

MDL-64427 course: Do not allow dirty cm_info during course delete

When deleting a course (especially one containing a large amount of
data) the course mod info cache could contain entries for deleted
activities for a signifcant amount of time making it possible that
users could see errors in Moodle.
This commit is contained in:
Neill Magill 2019-02-20 16:12:53 +00:00
parent 7289f5c0c1
commit d92acd5dcc

@ -5287,6 +5287,7 @@ function remove_course_contents($courseid, $showfeedback = true, array $options
// Delete cm and its context - orphaned contexts are purged in cron in case of any race condition.
context_helper::delete_instance(CONTEXT_MODULE, $cm->id);
$DB->delete_records('course_modules', array('id' => $cm->id));
rebuild_course_cache($cm->course, true);
}
}
}
@ -5323,6 +5324,7 @@ function remove_course_contents($courseid, $showfeedback = true, array $options
}
context_helper::delete_instance(CONTEXT_MODULE, $cm->id);
$DB->delete_records('course_modules', array('id' => $cm->id));
rebuild_course_cache($cm->course, true);
}
if ($showfeedback) {