Merge branch 'MDL-74900-main' of https://github.com/raortegar/moodle

This commit is contained in:
Huong Nguyen
2025-05-22 09:37:04 +07:00
+5
View File
@@ -763,6 +763,11 @@ function course_delete_module($cmid, $async = false) {
}
}
if (empty($cm->instance)) {
throw new moodle_exception('cannotdeletemodulemissinginstance', '', '', null,
"Cannot delete course module with ID $cm->id because it does not have a valid activity instance.");
}
// Call the delete_instance function, if it returns false throw an exception.
if (!$deleteinstancefunction($cm->instance)) {
throw new moodle_exception('cannotdeletemoduleinstance', '', '', null,