mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-17 05:48:43 +02:00
Outage now honours ABORT_AFTER_CONFIG CLI_SCRIPT AJAX_SCRIPT and WS_SERVER
This commit is contained in:
@@ -42,8 +42,13 @@ if (is_callable('auth_outage_bootstrap_callback')) {
|
||||
call_user_func('auth_outage_bootstrap_callback');
|
||||
}
|
||||
|
||||
// 2) Check for allowed IPs during outages.
|
||||
if (file_exists($CFG->dataroot.'/climaintenance.php')) {
|
||||
// 2) Check for allowed scripts or IPs during outages.
|
||||
$allowed = !file_exists($CFG->dataroot.'/climaintenance.php') // Not in maintenance mode.
|
||||
|| (defined('ABORT_AFTER_CONFIG') && ABORT_AFTER_CONFIG) // Only config requested.
|
||||
|| (defined('CLI_SCRIPT') && CLI_SCRIPT) // Allow CLI scripts.
|
||||
;
|
||||
if (!$allowed) {
|
||||
// Call the climaintenance.php which will check for allowed IPs.
|
||||
$CFG->dirroot = dirname(dirname(dirname(__FILE__))); // It is not defined yet but the script below needs it.
|
||||
require($CFG->dataroot.'/climaintenance.php'); // This call may terminate the script here or not.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user