Skip to content

Commit

Permalink
MDL-64427 course: Mark activities during course contents deletion
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
NeillM committed May 20, 2020
1 parent d92acd5 commit b26efcd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down

0 comments on commit b26efcd

Please sign in to comment.