mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 03:28:45 +02:00
N°3985 - Performance checks on the back end - Fix Session helper
This commit is contained in:
@@ -51,10 +51,8 @@ class LoginForm extends AbstractLoginFSMExtension implements iLoginUIExtension
|
||||
$this->bForceFormOnError = false;
|
||||
exit;
|
||||
}
|
||||
Session::Start();
|
||||
Session::Set('login_temp_auth_user', $sAuthUser);
|
||||
Session::Set('login_mode', 'form');
|
||||
Session::WriteClose();
|
||||
}
|
||||
return LoginWebPage::LOGIN_FSM_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -394,14 +394,12 @@ class LoginWebPage extends NiceWebPage
|
||||
public static function ResetSession()
|
||||
{
|
||||
// Unset all of the session variables.
|
||||
Session::Start();
|
||||
Session::Unset('auth_user');
|
||||
Session::Unset('login_state');
|
||||
Session::Unset('can_logoff');
|
||||
Session::Unset('archive_mode');
|
||||
Session::Unset('impersonate_user');
|
||||
UserRights::_ResetSessionCache();
|
||||
Session::WriteClose();
|
||||
// If it's desired to kill the session, also delete the session cookie.
|
||||
// Note: This will destroy the session, and not just the session data!
|
||||
}
|
||||
@@ -669,10 +667,8 @@ class LoginWebPage extends NiceWebPage
|
||||
$oLog->DBInsertNoReload();
|
||||
}
|
||||
|
||||
Session::Start();
|
||||
Session::Set('auth_user', $sAuthUser);
|
||||
Session::Set('login_mode', $sLoginMode);
|
||||
Session::WriteClose();
|
||||
UserRights::_InitSessionCache();
|
||||
}
|
||||
|
||||
@@ -1017,7 +1013,6 @@ class LoginWebPage extends NiceWebPage
|
||||
$sMessage = self::HandleOperations($operation); // May exit directly
|
||||
|
||||
$iRet = self::Login($iOnExit);
|
||||
|
||||
if ($iRet == self::EXIT_CODE_OK)
|
||||
{
|
||||
if ($bMustBeAdmin && !UserRights::IsAdministrator())
|
||||
|
||||
@@ -68,9 +68,10 @@ register_shutdown_function(function()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$oKPI = new ExecutionKPI();
|
||||
Session::Start();
|
||||
Session::WriteClose();
|
||||
$oKPI->ComputeAndReport("Session Start");
|
||||
|
||||
$sSwitchEnv = utils::ReadParam('switch_env', null);
|
||||
$bAllowCache = true;
|
||||
|
||||
@@ -1795,10 +1795,6 @@ class UserRights
|
||||
self::$m_aAdmins = array();
|
||||
self::$m_aPortalUsers = array();
|
||||
}
|
||||
if (!utils::IsModeCLI())
|
||||
{
|
||||
Session::Start();
|
||||
}
|
||||
self::_ResetSessionCache();
|
||||
if (self::$m_oAddOn)
|
||||
{
|
||||
@@ -1905,10 +1901,8 @@ class UserRights
|
||||
|
||||
public static function _ResetSessionCache()
|
||||
{
|
||||
Session::Start();
|
||||
Session::Unset('profile_list');
|
||||
Session::Unset('archive_allowed');
|
||||
Session::WriteClose();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,7 +49,6 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
|
||||
{
|
||||
if (Session::Get('login_mode') == 'cas')
|
||||
{
|
||||
Session::Start();
|
||||
static::InitCASClient();
|
||||
if (phpCAS::isAuthenticated())
|
||||
{
|
||||
@@ -72,7 +71,6 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
|
||||
Session::Set('login_mode', 'cas');
|
||||
phpCAS::forceAuthentication(); // Redirect to CAS and exit
|
||||
}
|
||||
Session::WriteClose();
|
||||
}
|
||||
return LoginWebPage::LOGIN_FSM_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -43,9 +43,11 @@ if ($sPage == '')
|
||||
}
|
||||
$sPage = basename($sPage); // protect against ../.. ...
|
||||
|
||||
$oKPI = new ExecutionKPI();
|
||||
Session::Start();
|
||||
$sEnvironment = utils::ReadParam('exec_env', utils::GetCurrentEnvironment());
|
||||
Session::WriteClose();
|
||||
$oKPI->ComputeAndReport("Session Start");
|
||||
|
||||
$sTargetPage = APPROOT.'env-'.$sEnvironment.'/'.$sModule.'/'.$sPage;
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\Helper;
|
||||
|
||||
use ExecutionKPI;
|
||||
|
||||
/**
|
||||
* Session management
|
||||
* Allow early session close to have multiple ajax calls in parallel
|
||||
@@ -26,7 +24,6 @@ class Session
|
||||
{
|
||||
self::$bIsInitialized = true;
|
||||
if (!self::$bSessionStarted) {
|
||||
$oKPI = new ExecutionKPI();
|
||||
session_name('itop-'.md5(APPROOT));
|
||||
if (!is_null(self::$iSessionId)) {
|
||||
session_id(self::$iSessionId);
|
||||
@@ -35,17 +32,14 @@ class Session
|
||||
self::$bSessionStarted = session_start();
|
||||
self::$iSessionId = session_id();
|
||||
}
|
||||
$oKPI->ComputeAndReport("Session Start");
|
||||
}
|
||||
}
|
||||
|
||||
public static function WriteClose()
|
||||
{
|
||||
if (self::$bSessionStarted) {
|
||||
$oKPI = new ExecutionKPI();
|
||||
session_write_close();
|
||||
self::$bSessionStarted = false;
|
||||
$oKPI->ComputeAndReport("Session Write Close");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +49,9 @@ class Session
|
||||
*/
|
||||
public static function Set($key, $value)
|
||||
{
|
||||
if (self::Get($key) == $value) {
|
||||
return;
|
||||
}
|
||||
$aSession = $_SESSION;
|
||||
$sSessionVar = &$aSession;
|
||||
if (is_array($key)) {
|
||||
|
||||
Reference in New Issue
Block a user