mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
"fixed eTemplates garbage collection to work with new session class, and lowed timeout of not used sessions to 30min (was 1h)"
This commit is contained in:
parent
505fe07669
commit
343ff1d77d
@ -271,13 +271,11 @@ class boetemplate extends soetemplate
|
|||||||
*/
|
*/
|
||||||
protected function get_appsession($id)
|
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);
|
//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;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,10 +290,8 @@ class boetemplate extends soetemplate
|
|||||||
*/
|
*/
|
||||||
static private function php_session_garbage_collection($id_used='')
|
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
|
// 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'];
|
$session_used =& $app_sessions['session_used'];
|
||||||
|
|
||||||
if ($id_used)
|
if ($id_used)
|
||||||
@ -316,10 +312,10 @@ class boetemplate extends soetemplate
|
|||||||
|
|
||||||
if (!$time) continue; // other data, no session
|
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])."<br>\n";
|
//echo ++$n.') '.$id.': '.(($now-$time)/100.0)."secs old, used=".$session_used[$id].", size=".egw_vfs::hsize(strlen(serialize($app_sessions[$id])))."<br>\n";
|
||||||
|
|
||||||
if ($session_used[$id] == 1 && $time < $now - 10*6000 || // session used and older then 10min
|
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 "<p>boetemplate::php_session_garbage_collection('$id_used'): unsetting session '$id' (now=$now)</p>\n";
|
//echo "<p>boetemplate::php_session_garbage_collection('$id_used'): unsetting session '$id' (now=$now)</p>\n";
|
||||||
unset($app_sessions[$id]);
|
unset($app_sessions[$id]);
|
||||||
|
Loading…
Reference in New Issue
Block a user