Skip to content

Commit

Permalink
MDL-59890 calendar: Delete category events upon category removal
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Oct 3, 2017
1 parent d0e56d8 commit 74475e5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/coursecatlib.php
Expand Up @@ -1756,6 +1756,9 @@ public function delete_full($showfeedback = true) {
throw new moodle_exception('cannotdeletecategoryquestions', '', '', $this->get_formatted_name());
}

// Delete all events in the category.
$DB->delete_records('event', array('categoryid' => $this->id));

// Finally delete the category and it's context.
$DB->delete_records('course_categories', array('id' => $this->id));

Expand Down

0 comments on commit 74475e5

Please sign in to comment.