mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-27 08:19:45 +01:00
"- try loading memcache extension, if not loaded
- allways use init_session_handler function (not only for php5.1)"
This commit is contained in:
parent
1a9388cc89
commit
630b81235e
@ -57,17 +57,6 @@ class egw_session_memcache
|
|||||||
{
|
{
|
||||||
self::$mbstring_func_overload = @extension_loaded('mbstring') && (ini_get('mbstring.func_overload') & 2);
|
self::$mbstring_func_overload = @extension_loaded('mbstring') && (ini_get('mbstring.func_overload') & 2);
|
||||||
|
|
||||||
if (version_compare(PHP_VERSION,'5.2','>='))
|
|
||||||
{
|
|
||||||
$ret = session_set_save_handler(
|
|
||||||
array(__CLASS__,'open'),
|
|
||||||
array(__CLASS__,'close'),
|
|
||||||
array(__CLASS__,'read'),
|
|
||||||
array(__CLASS__,'write'),
|
|
||||||
array(__CLASS__,'destroy'),
|
|
||||||
array(__CLASS__,'gc'));
|
|
||||||
if (!$ret) error_log(__METHOD__.'() session_set_save_handler(...)='.(int)$ret.', session_module_name()='.session_module_name().' *******************************');
|
|
||||||
}
|
|
||||||
// session needs to be closed before objects get destroyed, as this session-handler is an object ;-)
|
// session needs to be closed before objects get destroyed, as this session-handler is an object ;-)
|
||||||
register_shutdown_function('session_write_close');
|
register_shutdown_function('session_write_close');
|
||||||
}
|
}
|
||||||
@ -81,6 +70,10 @@ class egw_session_memcache
|
|||||||
*/
|
*/
|
||||||
public static function open($save_path, $session_name)
|
public static function open($save_path, $session_name)
|
||||||
{
|
{
|
||||||
|
if (!extension_loaded('memcache') && !dl(PHP_SHLIB_PREFIX.'memcache.'.PHP_SHLIB_SUFFIX))
|
||||||
|
{
|
||||||
|
throw new Exception("Required PHP extension 'memcache' not loaded AND can NOT be loaded!");
|
||||||
|
}
|
||||||
self::$memcache = new Memcache;
|
self::$memcache = new Memcache;
|
||||||
foreach(explode(',',$save_path) as $path)
|
foreach(explode(',',$save_path) as $path)
|
||||||
{
|
{
|
||||||
@ -270,19 +263,16 @@ class egw_session_memcache
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version_compare(PHP_VERSION,'5.2','<'))
|
function init_session_handler()
|
||||||
{
|
{
|
||||||
function init_session_handler()
|
$ses = 'egw_session_memcache';
|
||||||
{
|
$ret = session_set_save_handler(
|
||||||
$ses = 'egw_session_memcache';
|
array($ses,'open'),
|
||||||
$ret = session_set_save_handler(
|
array($ses,'close'),
|
||||||
array($ses,'open'),
|
array($ses,'read'),
|
||||||
array($ses,'close'),
|
array($ses,'write'),
|
||||||
array($ses,'read'),
|
array($ses,'destroy'),
|
||||||
array($ses,'write'),
|
array($ses,'gc'));
|
||||||
array($ses,'destroy'),
|
if (!$ret) error_log(__METHOD__.'() session_set_save_handler(...)='.(int)$ret.', session_module_name()='.session_module_name().' *******************************');
|
||||||
array($ses,'gc'));
|
|
||||||
if (!$ret) error_log(__METHOD__.'() session_set_save_handler(...)='.(int)$ret.', session_module_name()='.session_module_name().' *******************************');
|
|
||||||
}
|
|
||||||
init_session_handler();
|
|
||||||
}
|
}
|
||||||
|
init_session_handler();
|
Loading…
Reference in New Issue
Block a user