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

MDL-64427 course: Mark activities during course contents deletion

When we want to delete all of the activities in a course we should
mark them as having a deletion in progress, as this makes them
unavailable to users immediately.

This should make it much less likely that a request to get a context
that does not exist should be made when a user accesses a page.
This commit is contained in:
Neill Magill 2019-02-28 10:09:04 +00:00
parent d92acd5dcc
commit b26efcd861

@ -5245,6 +5245,9 @@ function remove_course_contents($courseid, $showfeedback = true, array $options
echo $OUTPUT->notification($strdeleted.get_string('type_block_plural', 'plugin'), 'notifysuccess');
}
$DB->set_field('course_modules', 'deletioninprogress', '1', ['course' => $courseid]);
rebuild_course_cache($courseid, true);
// Get the list of all modules that are properly installed.
$allmodules = $DB->get_records_menu('modules', array(), '', 'name, id');