made the session restore a bit more robust: if the session object could not be restored, destroy and re-create it

This commit is contained in:
Ralf Becker 2007-01-04 06:37:45 +00:00
parent fe5449397a
commit ec313158ee

View File

@ -85,11 +85,21 @@
} }
$GLOBALS['egw'] = unserialize($_SESSION['egw_object_cache']); $GLOBALS['egw'] = unserialize($_SESSION['egw_object_cache']);
if (is_object($GLOBALS['egw']))
{
$GLOBALS['egw']->wakeup2(); // adapt the restored egw-object/enviroment to this request (eg. changed current app) $GLOBALS['egw']->wakeup2(); // adapt the restored egw-object/enviroment to this request (eg. changed current app)
//printf("<p style=\"position: absolute; right: 0px; top: 0px;\">egw-enviroment restored in %d ms</p>\n",1000*(perfgetmicrotime()-$GLOBALS['egw_info']['flags']['page_start_time'])); //printf("<p style=\"position: absolute; right: 0px; top: 0px;\">egw-enviroment restored in %d ms</p>\n",1000*(perfgetmicrotime()-$GLOBALS['egw_info']['flags']['page_start_time']));
if (is_object($GLOBALS['egw']->translation)) return; // exit this file, as the rest of the file creates a new egw-object and -enviroment if (is_object($GLOBALS['egw']->translation)) return; // exit this file, as the rest of the file creates a new egw-object and -enviroment
} }
// egw object could NOT be restored from the session, create a new one
unset($GLOBALS['egw']);
$GLOBALS['egw_info'] = array('flags'=>$GLOBALS['egw_info']['flags']);
unset($GLOBALS['egw_info']['flags']['restored_from_session']);
unset($_SESSION['egw_info_cache']);
unset($_SESSION['egw_included_files']);
unset($_SESSION['egw_object_cache']);
}
//echo "<p>could not restore egw_info and the egw-object!!!</p>\n"; //echo "<p>could not restore egw_info and the egw-object!!!</p>\n";
} }
else // destroy the session-cache if called by login or logout else // destroy the session-cache if called by login or logout