MDL-24723 new CLI maintenance mode
This commit is contained in:
@@ -151,6 +151,26 @@ if (defined('WEB_CRON_EMULATED_CLI')) {
|
||||
}
|
||||
}
|
||||
|
||||
// Detect CLI maintenance mode - this is useful when you need to mess with database, such as during upgrades
|
||||
if (file_exists("$CFG->dataroot/climaintenance.html")) {
|
||||
if (!CLI_SCRIPT) {
|
||||
@header('Content-type: text/html');
|
||||
/// Headers to make it not cacheable and json
|
||||
@header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
@header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
@header('Pragma: no-cache');
|
||||
@header('Expires: Mon, 20 Aug 1969 09:23:00 GMT');
|
||||
@header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
@header('Accept-Ranges: none');
|
||||
readfile("$CFG->dataroot/climaintenance.html");
|
||||
die;
|
||||
} else {
|
||||
define('CLI_MAINTENANCE', true);
|
||||
}
|
||||
} else {
|
||||
define('CLI_MAINTENANCE', false);
|
||||
}
|
||||
|
||||
// Detect ajax scripts - they are similar to CLI because we can not redirect, output html, etc.
|
||||
if (!defined('AJAX_SCRIPT')) {
|
||||
define('AJAX_SCRIPT', false);
|
||||
|
||||
Reference in New Issue
Block a user