MDL-25921 show error when module table is missing
authorPetr Skoda <commits@skodak.org>
Sun, 30 Jan 2011 12:02:42 +0000 (13:02 +0100)
committerPetr Skoda <commits@skodak.org>
Sun, 30 Jan 2011 12:02:42 +0000 (13:02 +0100)
admin/modules.php

index 3ecb952..71e22bd 100644 (file)
             $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" .
                 "&amp;sesskey=".sesskey()."\" title=\"$strshowmodulecourse\">$count</a>";
-        }
-        else {
+        } else if ($count < 0) {
+            $countlink = get_string('error');
+        } else {
             $countlink = "$count";
         }