From 4467bea1cf526317754b0bb5e1c01515b77f2ac4 Mon Sep 17 00:00:00 2001 From: katcher Date: Wed, 18 Mar 2020 09:17:19 -0400 Subject: [PATCH 1/2] Issue 189 Unable to find Class 'core\ip_utils' Following upgrade of moodle to 3.5.11, error above prevented moodle from displaying on the web. The class ip_utils was for somereason not loaded and through an error preventing the site from displaying when in maintenance mod. Adding the require class appears to have fixed the issue. --- classes/local/outagelib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/local/outagelib.php b/classes/local/outagelib.php index 8a8b496..8af5aa9 100644 --- a/classes/local/outagelib.php +++ b/classes/local/outagelib.php @@ -269,6 +269,7 @@ class outagelib { if ((time() >= {{STARTTIME}}) && (time() < {{STOPTIME}})) { define('MOODLE_INTERNAL', true); require_once($CFG->dirroot.'/lib/moodlelib.php'); + require_once($CFG->dirroot.'/lib/classes/ip_utils.php'); if (!remoteip_in_list('{{ALLOWEDIPS}}')) { header($_SERVER['SERVER_PROTOCOL'] . ' 503 Moodle under maintenance'); header('Status: 503 Moodle under maintenance'); From 777e466a0ad5e3c22eb63720d30c25fbee2c8d61 Mon Sep 17 00:00:00 2001 From: Peter Burnett Date: Wed, 25 Mar 2020 15:15:02 +1000 Subject: [PATCH 2/2] Issue #189: Updated unit tests --- tests/phpunit/local/outagelib_test.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/phpunit/local/outagelib_test.php b/tests/phpunit/local/outagelib_test.php index 40ec445..d5ecf60 100644 --- a/tests/phpunit/local/outagelib_test.php +++ b/tests/phpunit/local/outagelib_test.php @@ -289,6 +289,7 @@ class outagelib_test extends advanced_testcase { if ((time() >= 123) && (time() < 456)) { define('MOODLE_INTERNAL', true); require_once($CFG->dirroot.'/lib/moodlelib.php'); + require_once($CFG->dirroot.'/lib/classes/ip_utils.php'); if (!remoteip_in_list('hey\'\"you a.b.c.d e.e.e.e/20')) { @@ -330,6 +331,7 @@ EOT; if ((time() >= 123) && (time() < 456)) { define('MOODLE_INTERNAL', true); require_once($CFG->dirroot.'/lib/moodlelib.php'); + require_once($CFG->dirroot.'/lib/classes/ip_utils.php'); if (!remoteip_in_list('127.0.0.1')) { header($_SERVER['SERVER_PROTOCOL'] . ' 503 Moodle under maintenance'); header('Status: 503 Moodle under maintenance');