MDL-46671 availability: DEBUG when course_module does not exist.

There was a fatal error when calendar event linked to non-extant activities.

Now, instead of throwing an exception when a course_module does not exist, is_user_visible() will print a debug statement.
This commit is contained in:
PJ King
2015-01-02 09:38:21 -05:00
parent 56624fa968
commit 719c2dac88
+6 -1
View File
@@ -157,7 +157,12 @@ class info_module extends info {
if (is_object($cmorid)) {
$cmorid = $cmorid->id;
}
$cm = $DB->get_record('course_modules', array('id' => $cmorid), '*', MUST_EXIST);
$cm = $DB->get_record('course_modules', array('id' => $cmorid));
if (!$cm) {
// In some error cases, the course module may not exist.
debugging('info_module::is_user_visible called with invalid cmid ' . $cmorid, DEBUG_DEVELOPER);
return false;
}
}
// Check the groupmembersonly feature.