protected function _initSession() { $configSession = new Zend_Config_Ini(APPLICATION_PATH . '/configs/session.ini', APPLICATION_ENV); if (!$this->_request->isInstalling()) { $config = array('name' => 'session', 'primary' => 'session_id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime', 'lifetime' => $configSession->gc_maxlifetime); Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config)); } if (!$this->_request->isInstalling() or is_writable(Core_Model_Directory::getSessionDirectory(true))) { $types = array(); $options = $configSession->toArray(); if (isset($options['types'])) { $types = $options['types']; unset($options['types']); } Zend_Session::start($options); $session_type = $this->_request->isApplication() ? 'mobile' : 'front'; $session = new Core_Model_Session($session_type); foreach ($types as $type => $class) { $session->addType($type, $class); } $language_session = new Core_Model_Session('language'); if (!$language_session->current_language) { $language_session->current_language = null; } Core_Model_Language::setSession($language_session); Core_View_Default::setSession($session); Core_Controller_Default::setSession($session); } }
protected function _initSession() { if (Zend_Session::isStarted()) { return $this; } $configSession = new Zend_Config_Ini(APPLICATION_PATH . '/configs/session.ini', APPLICATION_ENV); if (!$this->getRequest()->isInstalling()) { $config = array('name' => 'session', 'primary' => 'session_id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime', 'lifetime' => $configSession->gc_maxlifetime); Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config)); } if (!$this->getRequest()->isInstalling() or is_writable(Core_Model_Directory::getSessionDirectory(true))) { $options = $configSession->toArray(); Zend_Session::start($options); $session_type = 'front'; if ($this->getRequest()->isApplication()) { $session_type = 'mobile'; } else { if ($this->_isInstanceOfBackoffice()) { $session_type = 'backoffice'; } } defined('SESSION_TYPE') || define('SESSION_TYPE', $session_type); $session = new Core_Model_Session($session_type); Core_Model_Language::setSession($session); Core_View_Default::setSession($session, $session_type); Core_Model_Default::setSession($session, $session_type); self::setSession($session, $session_type); } }