mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-24 12:54:11 +01:00
Compare commits
2 Commits
support/3.
...
issue/8540
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
daee4811e8 | ||
|
|
833217f467 |
@@ -63,9 +63,6 @@ register_shutdown_function(function () {
|
||||
}
|
||||
}
|
||||
});
|
||||
$oKPI = new ExecutionKPI();
|
||||
Session::Start();
|
||||
$oKPI->ComputeAndReport("Session Start");
|
||||
|
||||
$sSwitchEnv = utils::ReadParam('switch_env', null);
|
||||
$bAllowCache = true;
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
*
|
||||
* @since 3.0.0 N°2214
|
||||
*/
|
||||
|
||||
use Combodo\iTop\Application\Helper\Session;
|
||||
|
||||
$bIsValidPhpVersion = false;
|
||||
if (PHP_MAJOR_VERSION >= 7) {
|
||||
$bIsValidPhpVersion = true;
|
||||
@@ -44,20 +47,21 @@ define('READONLY_MODE_FILE', APPROOT.'data/.readonly');
|
||||
|
||||
$fItopStarted = microtime(true);
|
||||
$iItopInitialMemory = memory_get_usage(true);
|
||||
|
||||
$bBypassMaintenance = false;
|
||||
if (!isset($GLOBALS['bBypassAutoload']) || $GLOBALS['bBypassAutoload'] == false) {
|
||||
require_once APPROOT.'/lib/autoload.php';
|
||||
// Start the session here to read the "bBypassMaintenance" param
|
||||
$oKPI = new ExecutionKPI();
|
||||
Session::Start();
|
||||
$oKPI->ComputeAndReport('Session Start');
|
||||
|
||||
// Now bBypassMaintenance mode is set in the session rather than the request params
|
||||
$bBypassMaintenance = Session::Get('bBypassMaintenance', false);
|
||||
}
|
||||
|
||||
//
|
||||
// Maintenance mode
|
||||
//
|
||||
|
||||
// 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) {
|
||||
$sTitle = 'Maintenance';
|
||||
$sMessage = 'This application is currently under maintenance.';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<menu id="iTopUpdate" xsi:type="WebPageMenuNode" _delta="define">
|
||||
<rank>60</rank>
|
||||
<parent>SystemTools</parent>
|
||||
<url>$pages/UI.php?route=core_update.select_update_file&maintenance=true</url>
|
||||
<url>$pages/UI.php?route=core_update.select_update_file</url>
|
||||
<enable_admin_only>1</enable_admin_only>
|
||||
</menu>
|
||||
</menus>
|
||||
|
||||
@@ -15,8 +15,7 @@ var oGetCurrentVersion = {
|
||||
method: "POST",
|
||||
url: "{{ sAjaxURL|raw }}",
|
||||
data: {
|
||||
route: "core_update_ajax.get_current_version",
|
||||
maintenance: true
|
||||
route: "core_update_ajax.get_current_version"
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data)
|
||||
@@ -36,8 +35,7 @@ function GetAjaxRequest(sOperation)
|
||||
url: "{{ sAjaxURL|raw }}",
|
||||
data: {
|
||||
route: sOperation,
|
||||
authent: "{{ sSetupToken }}",
|
||||
maintenance: true
|
||||
authent: "{{ sSetupToken }}"
|
||||
},
|
||||
dataType: "json"
|
||||
};
|
||||
|
||||
@@ -26,8 +26,21 @@
|
||||
* @since 3.0.0 N°3253
|
||||
*/
|
||||
|
||||
use Combodo\iTop\Application\Helper\Session;
|
||||
|
||||
require_once('../lib/autoload.php');
|
||||
|
||||
// Hack for setup, we need these constants in the session
|
||||
define('APPROOT', dirname(__DIR__).'/');
|
||||
define('APPCONF', APPROOT.'conf/');
|
||||
define('ITOP_DEFAULT_ENV', 'production');
|
||||
|
||||
Session::Start();
|
||||
if (!Session::Get('bBypassMaintenance', false)) {
|
||||
// Allow setup in maintenance mode
|
||||
Session::Set('bBypassMaintenance', true);
|
||||
}
|
||||
|
||||
echo <<<HTML
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
@@ -1940,6 +1940,7 @@ JS
|
||||
{
|
||||
$bPreviousMode = self::IsInMaintenanceMode();
|
||||
@touch(MAINTENANCE_MODE_FILE);
|
||||
Session::Set('bBypassMaintenance', true);
|
||||
SetupLog::Info("----> Entering maintenance mode");
|
||||
self::WaitCronTermination($oConfig, "maintenance");
|
||||
return $bPreviousMode;
|
||||
@@ -1948,6 +1949,7 @@ JS
|
||||
public static function ExitMaintenanceMode($bLog = true)
|
||||
{
|
||||
@unlink(MAINTENANCE_MODE_FILE);
|
||||
Session::Set('bBypassMaintenance', false);
|
||||
if ($bLog) {
|
||||
SetupLog::Info("<---- Exiting maintenance mode");
|
||||
}
|
||||
|
||||
@@ -35,7 +35,10 @@ class Session
|
||||
}
|
||||
|
||||
if (!self::$bIsInitialized) {
|
||||
SessionHandler::session_set_save_handler();
|
||||
if (defined('MAINTENANCE_MODE_FILE')) {
|
||||
// Hack for setup, SessionHandler cannot work under setup
|
||||
SessionHandler::session_set_save_handler();
|
||||
}
|
||||
session_name('itop-'.md5(APPROOT));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user