Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion classes/reporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function get_diagnosis() {
*
* @return array of diagnosis
*/
private function get_diagnosis_data(array $taskids = null) {
private function get_diagnosis_data(?array $taskids = null) {
$diagnoses = array();
$deletetaskslist = new delete_task_list($this->minimumfaildelay);
$deletetasks = $deletetaskslist->get_deletetasks();
Expand Down
8 changes: 7 additions & 1 deletion classes/surgeon.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,13 @@ private function delete_module_cleanly(diagnosis $diagnosis) {
}

// Notify the competency subsystem.
\core_competency\api::hook_course_module_deleted($cm);
// The function hook_course_module_deleted() deletes the module context in 5.1+.
// context_module::instance($cm->id); causes dml_missing_record_exception when the course_modules record is already absent.
try {
\core_competency\api::hook_course_module_deleted($cm);
} catch (\dml_missing_record_exception $e) {
// Context no longer exists; competency data already cleaned up or not present.
}

// Delete the context.
if ($modcontext) {
Expand Down
Loading