From 343ff1d77d62d06acc8b48b3b7f25bf8b02121c1 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 13 Nov 2008 17:20:53 +0000 Subject: [PATCH] "fixed eTemplates garbage collection to work with new session class, and lowed timeout of not used sessions to 30min (was 1h)" --- etemplate/inc/class.boetemplate.inc.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/etemplate/inc/class.boetemplate.inc.php b/etemplate/inc/class.boetemplate.inc.php index e078c67827..8c0869d042 100644 --- a/etemplate/inc/class.boetemplate.inc.php +++ b/etemplate/inc/class.boetemplate.inc.php @@ -271,13 +271,11 @@ class boetemplate extends soetemplate */ protected function get_appsession($id) { - $data = $GLOBALS['egw']->session->appsession($id,'etemplate'); + $data = egw_session::appsession($id,'etemplate'); //echo "boetemplate::get_appsession('$id')"; _debug_array($data); - if (substr($GLOBALS['egw_info']['server']['sessions_type'],0,4) == 'php4') - { - self::php_session_garbage_collection($id); - } + self::php_session_garbage_collection($id); + return $data; } @@ -292,10 +290,8 @@ class boetemplate extends soetemplate */ static private function php_session_garbage_collection($id_used='') { - if (!defined('EGW_SESSION_VAR')) return; // for 1.0.0 compatibility - // now we are on php4 sessions and do a bit of garbage collection - $app_sessions =& $_SESSION[EGW_SESSION_VAR]['app_sessions']['etemplate']; + $app_sessions =& $_SESSION[egw_session::EGW_APPSESSION_VAR]['etemplate']; $session_used =& $app_sessions['session_used']; if ($id_used) @@ -316,10 +312,10 @@ class boetemplate extends soetemplate if (!$time) continue; // other data, no session - //echo ++$n.') '.$id.': '.(($now-$time)/100.0)."secs old, used=".$session_used[$id].", size=".strlen($app_sessions[$id])."
\n"; + //echo ++$n.') '.$id.': '.(($now-$time)/100.0)."secs old, used=".$session_used[$id].", size=".egw_vfs::hsize(strlen(serialize($app_sessions[$id])))."
\n"; if ($session_used[$id] == 1 && $time < $now - 10*6000 || // session used and older then 10min - $time < $now - 60*6000) // session not used and older then 1h + $time < $now - 30*6000) // session not used and older then 30min { //echo "

boetemplate::php_session_garbage_collection('$id_used'): unsetting session '$id' (now=$now)

\n"; unset($app_sessions[$id]);