From 36166f95d450610d4882e8ced0b72a24fbc2e51c Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Fri, 12 Jul 2013 10:45:07 +1000 Subject: [PATCH] Prevent fatal error on fresh install --- version.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/version.php b/version.php index 48c313b..c720dc5 100644 --- a/version.php +++ b/version.php @@ -33,8 +33,13 @@ $module->component = 'mod_attendance'; // TODO: remove this asap. if (defined('MOODLE_INTERNAL')) { // Only run if config.php has already been included. global $DB; - if ($DB->record_exists('modules', array('name' =>'attforblock'))) { - require_once('locallib.php'); - attforblock_upgrade(); + try { + if ($DB->record_exists('modules', array('name' =>'attforblock'))) { + require_once('locallib.php'); + attforblock_upgrade(); + } + } catch (Exception $e) { + // Probably a fresh install - modules table doesn't exist } + }