Commit 2fe87d95 authored by sam marshall's avatar sam marshall
Browse files

MDL-69687 Course: Improve removal of completion data on MySQL

parent edb5cd0d
......@@ -5327,9 +5327,8 @@ function remove_course_contents($courseid, $showfeedback = true, array $options
// Remove all data from availability and completion tables that is associated
// with course-modules belonging to this course. Note this is done even if the
// features are not enabled now, in case they were enabled previously.
'coursemoduleid IN (SELECT id from {course_modules} WHERE course=?)',
$DB->delete_records_subquery('course_modules_completion', 'coursemoduleid', 'id',
'SELECT id from {course_modules} WHERE course = ?', [$courseid]);
// Remove course-module data that has not been removed in modules' _delete_instance callbacks.
$cms = $DB->get_records('course_modules', array('course' => $course->id));
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment