MDL-25921 show error when module table is missing
This commit is contained in:
+8
-3
@@ -141,12 +141,17 @@
|
||||
$settings = "";
|
||||
}
|
||||
|
||||
$count = $DB->count_records_select($module->name, "course<>0");
|
||||
try {
|
||||
$count = $DB->count_records_select($module->name, "course<>0");
|
||||
} catch (dml_exception $e) {
|
||||
$count = -1;
|
||||
}
|
||||
if ($count>0) {
|
||||
$countlink = "<a href=\"{$CFG->wwwroot}/course/search.php?modulelist=$module->name" .
|
||||
"&sesskey=".sesskey()."\" title=\"$strshowmodulecourse\">$count</a>";
|
||||
}
|
||||
else {
|
||||
} else if ($count < 0) {
|
||||
$countlink = get_string('error');
|
||||
} else {
|
||||
$countlink = "$count";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user