diff --git a/application/utils.inc.php b/application/utils.inc.php index 2f972e4fb3..0e2ada5154 100644 --- a/application/utils.inc.php +++ b/application/utils.inc.php @@ -155,7 +155,10 @@ class utils } // Read and record the value for switching the archive mode $iCurrent = self::ReadParam('with-archive', $iDefault); - $_SESSION['archive_mode'] = $iCurrent; + if (isset($_SESSION)) + { + $_SESSION['archive_mode'] = $iCurrent; + } // Read and use the value for the current page (web services) $iCurrent = self::ReadParam('with_archive', $iCurrent, true); self::$bPageMode = ($iCurrent == 1); diff --git a/core/metamodel.class.php b/core/metamodel.class.php index eb713bf27d..fa1642235e 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -5261,20 +5261,26 @@ abstract class MetaModel public static function ResetCache($sEnvironmentId = null) { - if (!function_exists('apc_delete')) return; if (is_null($sEnvironmentId)) { $sEnvironmentId = MetaModel::GetEnvironmentId(); } $sAppIdentity = 'itop-'.$sEnvironmentId; + require_once(APPROOT.'/core/dict.class.inc.php'); Dict::ResetCache($sAppIdentity); - foreach(self::GetCacheEntries($sEnvironmentId) as $sKey => $aAPCInfo) + if (function_exists('apc_delete')) { - $sAPCKey = $aAPCInfo['info']; - apc_delete($sAPCKey); + foreach (self::GetCacheEntries($sEnvironmentId) as $sKey => $aAPCInfo) + { + $sAPCKey = $aAPCInfo['info']; + apc_delete($sAPCKey); + } } + + require_once(APPROOT.'core/userrights.class.inc.php'); + UserRights::FlushPrivileges(); } /** diff --git a/core/userrights.class.inc.php b/core/userrights.class.inc.php index acfda6efb1..a53f1ac689 100644 --- a/core/userrights.class.inc.php +++ b/core/userrights.class.inc.php @@ -1152,8 +1152,16 @@ class UserRights self::$m_aAdmins = array(); self::$m_aPortalUsers = array(); } + if (!isset($_SESSION)) + { + session_name('itop-'.md5(APPROOT)); + session_start(); + } self::_ResetSessionCache(); - return self::$m_oAddOn->FlushPrivileges(); + if (self::$m_oAddOn) + { + self::$m_oAddOn->FlushPrivileges(); + } } static $m_aCacheUsers; diff --git a/setup/runtimeenv.class.inc.php b/setup/runtimeenv.class.inc.php index c741625d65..abbfbd356c 100644 --- a/setup/runtimeenv.class.inc.php +++ b/setup/runtimeenv.class.inc.php @@ -505,7 +505,6 @@ class RunTimeEnvironment SetupUtils::builddir($sCacheDir); SetupUtils::tidydir($sCacheDir); - require_once(APPROOT.'/core/dict.class.inc.php'); MetaModel::ResetCache(md5(APPROOT).'-'.$this->sTargetEnv); } }