From fe773fcdc6d820a5f78d0cb74d738a63b2d39a61 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Fri, 12 Jul 2013 11:04:44 +1000 Subject: [PATCH] slightly better check - there's probably a cfg var I could check here instead of using try/catch --- version.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/version.php b/version.php index dc5b736..e37c340 100644 --- a/version.php +++ b/version.php @@ -33,13 +33,16 @@ $module->component = 'mod_attendance'; // TODO: remove this asap. if (defined('MOODLE_INTERNAL')) { // Only run if config.php has already been included. global $DB; + $moduleexists = false; + try { - if ($DB->record_exists('modules', array('name' =>'attforblock'))) { - require_once('locallib.php'); - attforblock_upgrade(); - } + $moduleexists = $DB->record_exists('modules', array('name' =>'attforblock')); } catch (Exception $e) { // Probably a fresh install - modules table doesn't exist } + if ($moduleexists) { + require_once('locallib.php'); + attforblock_upgrade(); + } }