diff options
author | robocoder <anthon.pang@gmail.com> | 2011-07-01 20:47:14 +0400 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2011-07-01 20:47:14 +0400 |
commit | 0f0aced9835cd40eea6c240a2da6cf4d68ac466f (patch) | |
tree | 29d514cc455082665af58ef684d63936205ee68c /core/Session.php | |
parent | c185be5a70f37b5b0af1ee96ff3adf8f580d9a24 (diff) |
refs #2491 - see ZF-11521
git-svn-id: http://dev.piwik.org/svn/trunk@4958 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/Session.php')
-rw-r--r-- | core/Session.php | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/core/Session.php b/core/Session.php index 4ac960e7d0..5dd32a4a0e 100644 --- a/core/Session.php +++ b/core/Session.php @@ -66,8 +66,12 @@ class Piwik_Session extends Zend_Session 'lifetimeColumn' => 'lifetime', 'db' => $db, ); - - self::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config)); + + $saveHandler = new Zend_Session_SaveHandler_DbTable($config); + if($saveHandler) + { + self::setSaveHandler($saveHandler); + } } // garbage collection may disabled by default (e.g., Debian) @@ -78,10 +82,22 @@ class Piwik_Session extends Zend_Session try { Zend_Session::start(); - register_shutdown_function(array('Zend_Session', 'writeClose'), true); + register_shutdown_function(array('Piwik_Session', 'writeClose'), true); } catch(Exception $e) { Piwik::log('Unable to start session: ' . $e->getMessage()); Piwik_ExitWithMessage(Piwik_Translate('General_ExceptionUnableToStartSession')); } } + + /** + * writeClose() - Shutdown the sesssion, close writing and detach $_SESSION from the back-end storage mechanism. + * This will complete the internal data transformation on this request. + * + * @param bool $readonly - remove write access + * @return void + */ + public static function writeClose($readOnly = true) + { + Zend_Session::writeClose($readOnly); + } } |