Index: course/reset_form.php =================================================================== --- course/reset_form.php (revision 17607) +++ course/reset_form.php (working copy) @@ -58,16 +58,14 @@ if ($allmods = $DB->get_records('modules') ) { foreach ($allmods as $mod) { $modname = $mod->name; - try { - if (!$DB->count_records($modname, array('course'=>$COURSE->id))) { - continue; // skip mods with no instances - } - } catch (Exception $e) { - // Exception here probably means the table doesn't exist or doesn't - // have an expected column. This can happen with old modules that - // haven't been updated to 2.x on a site upgraded from 1.x. - // Skip the module and continue. - continue; + if (!$DB->get_manager()->table_exists($modname)) { + continue; // Skip mods with a missing table + } + if (!$DB->get_manager()->field_exists($modname, 'course')) { + continue; // Skip mods with a missing 'course' field + } + if (!$DB->count_records($modname, array('course'=>$COURSE->id))) { + continue; // skip mods with no instances } $modfile = $CFG->dirroot."/mod/$modname/lib.php"; $mod_reset_course_form_definition = $modname.'_reset_course_form_definition';