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
2020-05-20 08:30:04 +01:00
parent 7a168c3beb
commit 34f176586b
+2
View File
@@ -5250,6 +5250,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);
}
}
}
@@ -5286,6 +5287,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) {