import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
* @subpackage Resource
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Session.php 16200 2009-06-21 18:50:06Z thomas $
|
||||
* @version $Id: Session.php 18204 2009-09-17 22:13:16Z beberlei $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -48,28 +48,47 @@ class Zend_Application_Resource_Session extends Zend_Application_Resource_Resour
|
||||
*/
|
||||
public function setSaveHandler($saveHandler)
|
||||
{
|
||||
if (is_array($saveHandler)) {
|
||||
if (!array_key_exists('class', $saveHandler)) {
|
||||
throw new Zend_Application_Resource_Exception('Session save handler class not provided in options');
|
||||
}
|
||||
if (array_key_exists('options', $saveHandler)) {
|
||||
$options = $saveHandler['options'];
|
||||
}
|
||||
$saveHandler = $saveHandler['class'];
|
||||
$saveHandler = new $saveHandler($options);
|
||||
} elseif (is_string($saveHandler)) {
|
||||
$saveHandler = new $saveHandler();
|
||||
}
|
||||
|
||||
if (!$saveHandler instanceof Zend_Session_SaveHandler_Interface) {
|
||||
throw new Zend_Application_Resource_Exception('Invalid session save handler');
|
||||
}
|
||||
|
||||
$this->_saveHandler = $saveHandler;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get session save handler
|
||||
*
|
||||
* @return Zend_Session_SaveHandler_Interface
|
||||
*/
|
||||
public function getSaveHandler()
|
||||
{
|
||||
if (!$this->_saveHandler instanceof Zend_Session_SaveHandler_Interface) {
|
||||
if (is_array($this->_saveHandler)) {
|
||||
if (!array_key_exists('class', $this->_saveHandler)) {
|
||||
throw new Zend_Application_Resource_Exception('Session save handler class not provided in options');
|
||||
}
|
||||
$options = array();
|
||||
if (array_key_exists('options', $this->_saveHandler)) {
|
||||
$options = $this->_saveHandler['options'];
|
||||
}
|
||||
$this->_saveHandler = $this->_saveHandler['class'];
|
||||
$this->_saveHandler = new $this->_saveHandler($options);
|
||||
} elseif (is_string($this->_saveHandler)) {
|
||||
$this->_saveHandler = new $this->_saveHandler();
|
||||
}
|
||||
|
||||
if (!$this->_saveHandler instanceof Zend_Session_SaveHandler_Interface) {
|
||||
throw new Zend_Application_Resource_Exception('Invalid session save handler');
|
||||
}
|
||||
}
|
||||
return $this->_saveHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function _hasSaveHandler()
|
||||
{
|
||||
return ($this->_saveHandler !== null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Application_Resource_Resource
|
||||
*
|
||||
@ -86,8 +105,8 @@ class Zend_Application_Resource_Session extends Zend_Application_Resource_Resour
|
||||
Zend_Session::setOptions($options);
|
||||
}
|
||||
|
||||
if ($this->_saveHandler !== null) {
|
||||
Zend_Session::setSaveHandler($this->_saveHandler);
|
||||
if ($this->_hasSaveHandler()) {
|
||||
Zend_Session::setSaveHandler($this->getSaveHandler());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user