MDL-24723 new CLI maintenance mode

This commit is contained in:
Petr Skoda
2010-10-18 12:48:39 +00:00
parent aa0dd423f7
commit 8820f4e751
+20
View File
@@ -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);