From bf2496652cfb8c9e0951e91e96996ed6032c239e Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Thu, 4 Jul 2013 12:37:20 +1200 Subject: [PATCH] only check upgrade if config.php has been included before loading this file. --- version.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/version.php b/version.php index 4da10d4..7dd4157 100644 --- a/version.php +++ b/version.php @@ -31,8 +31,10 @@ $module->component = 'mod_attendance'; // Nasty upgrade code to check if need to upgrade from attforblock. // TODO: remove this asap. -global $DB; -if ($DB->record_exists('modules', array('name' =>'attforblock'))) { - require_once('locallib.php'); - attforblock_upgrade(); +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(); + } }