remove facility to keep not autoloadable classes in EGroupware session, as there are no such classes anymore

This commit is contained in:
ralf 2024-10-07 16:34:25 +02:00
parent c79f6c3b28
commit f772bf69cd
2 changed files with 1 additions and 34 deletions

View File

@ -55,13 +55,6 @@ class Session
*/ */
const EGW_APPSESSION_VAR = 'egw_app_session'; const EGW_APPSESSION_VAR = 'egw_app_session';
/**
* key of eGW's required files in $_SESSION
*
* These files get set by Db and Egw class, for classes which get not autoloaded (eg. ADOdb, idots_framework)
*/
const EGW_REQUIRED_FILES = 'egw_required_files';
/** /**
* key of eGW's egw_info cached in $_SESSION * key of eGW's egw_info cached in $_SESSION
*/ */
@ -160,13 +153,6 @@ class Session
*/ */
private $egw_domains; private $egw_domains;
/**
* $_SESSION at the time the constructor was called
*
* @var array
*/
var $required_files;
/** /**
* Nummeric code why session creation failed * Nummeric code why session creation failed
* *
@ -212,8 +198,6 @@ class Session
*/ */
function __construct(array $domain_names=null) function __construct(array $domain_names=null)
{ {
$this->required_files = $_SESSION[self::EGW_REQUIRED_FILES];
$this->sessionid = self::get_sessionid(); $this->sessionid = self::get_sessionid();
$this->kp3 = self::get_request('kp3'); $this->kp3 = self::get_request('kp3');
@ -983,13 +967,6 @@ class Session
*/ */
private function register_session($login,$user_ip,$now,$session_flags) private function register_session($login,$user_ip,$now,$session_flags)
{ {
// restore session vars set before session was started
if (is_array($this->required_files))
{
$_SESSION[self::EGW_REQUIRED_FILES] = !is_array($_SESSION[self::EGW_REQUIRED_FILES] ?? null) ? $this->required_files :
array_unique(array_merge($_SESSION[self::EGW_REQUIRED_FILES],$this->required_files));
unset($this->required_files);
}
$_SESSION[self::EGW_SESSION_VAR] = array( $_SESSION[self::EGW_SESSION_VAR] = array(
'session_id' => $this->sessionid, 'session_id' => $this->sessionid,
'session_lid' => $login, 'session_lid' => $login,

View File

@ -56,7 +56,7 @@ if (Session::init_handler())
{ {
if ($GLOBALS['egw_info']['flags']['currentapp'] != 'login' && $GLOBALS['egw_info']['flags']['currentapp'] != 'logout') if ($GLOBALS['egw_info']['flags']['currentapp'] != 'login' && $GLOBALS['egw_info']['flags']['currentapp'] != 'logout')
{ {
if (is_array($_SESSION[Session::EGW_INFO_CACHE]) && $_SESSION[Session::EGW_OBJECT_CACHE] && $_SESSION[Session::EGW_REQUIRED_FILES]) if (is_array($_SESSION[Session::EGW_INFO_CACHE]) && !empty($_SESSION[Session::EGW_OBJECT_CACHE]))
{ {
// marking the context as restored from the session, used by session->verify to not read the data from the db again // marking the context as restored from the session, used by session->verify to not read the data from the db again
$GLOBALS['egw_info']['flags']['restored_from_session'] = true; $GLOBALS['egw_info']['flags']['restored_from_session'] = true;
@ -64,14 +64,6 @@ if (Session::init_handler())
// restoring the egw_info-array // restoring the egw_info-array
$GLOBALS['egw_info'] = array_merge($_SESSION[Session::EGW_INFO_CACHE],array('flags' => $GLOBALS['egw_info']['flags'])); $GLOBALS['egw_info'] = array_merge($_SESSION[Session::EGW_INFO_CACHE],array('flags' => $GLOBALS['egw_info']['flags']));
// include required class-definitions
if (is_array($_SESSION[Session::EGW_REQUIRED_FILES])) // all classes, which can not be autoloaded
{
foreach($_SESSION[Session::EGW_REQUIRED_FILES] as $file)
{
require_once($file);
}
}
$GLOBALS['egw'] = unserialize($_SESSION[Session::EGW_OBJECT_CACHE], ['allowed_classes' => true]); $GLOBALS['egw'] = unserialize($_SESSION[Session::EGW_OBJECT_CACHE], ['allowed_classes' => true]);
if (is_object($GLOBALS['egw']) && ($GLOBALS['egw'] instanceof Egw)) // only egw object has wakeup2, setups egw_minimal eg. has not! if (is_object($GLOBALS['egw']) && ($GLOBALS['egw'] instanceof Egw)) // only egw object has wakeup2, setups egw_minimal eg. has not!
@ -86,14 +78,12 @@ if (Session::init_handler())
$GLOBALS['egw_info'] = array('flags'=>$GLOBALS['egw_info']['flags']); $GLOBALS['egw_info'] = array('flags'=>$GLOBALS['egw_info']['flags']);
unset($GLOBALS['egw_info']['flags']['restored_from_session']); unset($GLOBALS['egw_info']['flags']['restored_from_session']);
unset($_SESSION[Session::EGW_INFO_CACHE]); unset($_SESSION[Session::EGW_INFO_CACHE]);
unset($_SESSION[Session::EGW_REQUIRED_FILES]);
unset($_SESSION[Session::EGW_OBJECT_CACHE]); unset($_SESSION[Session::EGW_OBJECT_CACHE]);
} }
} }
else // destroy the session-cache if called by login or logout else // destroy the session-cache if called by login or logout
{ {
unset($_SESSION[Session::EGW_INFO_CACHE]); unset($_SESSION[Session::EGW_INFO_CACHE]);
unset($_SESSION[Session::EGW_REQUIRED_FILES]);
unset($_SESSION[Session::EGW_OBJECT_CACHE]); unset($_SESSION[Session::EGW_OBJECT_CACHE]);
} }
} }