mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
N°2240 - Supportability - Maintenance mode
This commit is contained in:
31
index.php
31
index.php
@@ -3,36 +3,7 @@ $sConfigFile = 'conf/production/config-itop.php';
|
||||
$sStartPage = './pages/UI.php';
|
||||
$sSetupPage = './setup/index.php';
|
||||
|
||||
//
|
||||
// Maintenance mode
|
||||
//
|
||||
define('APPROOT', dirname(__FILE__).'/');
|
||||
define('MAINTENANCE_MODE_FILE', APPROOT.'data/.maintenance');
|
||||
|
||||
// Use 'maintenance' parameter to bypass maintenance mode
|
||||
if (!isset($bBypassMaintenance))
|
||||
{
|
||||
$bBypassMaintenance = isset($_REQUEST['maintenance']) ? boolval($_REQUEST['maintenance']) : false;
|
||||
}
|
||||
|
||||
if (file_exists(MAINTENANCE_MODE_FILE) && !$bBypassMaintenance)
|
||||
{
|
||||
http_response_code(503);
|
||||
echo 'This application is currently under maintenance';
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* helper to test if a string ends with another
|
||||
* @param $haystack
|
||||
* @param $needle
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function EndsWith($haystack, $needle) {
|
||||
return substr_compare($haystack, $needle, -strlen($needle)) === 0;
|
||||
}
|
||||
|
||||
require_once('approot.inc.php');
|
||||
|
||||
/**
|
||||
* Check that the configuration file exists and has the appropriate access rights
|
||||
|
||||
Reference in New Issue
Block a user