Merge branch 'w05_MDL-25921_20_tablemissing' of git://github.com/skodak/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 31 Jan 2011 15:01:02 +0000 (16:01 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 31 Jan 2011 15:01:02 +0000 (16:01 +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";
         }