/**
  * Initializes the application component.
  *
  * @return null
  */
 public function init()
 {
     $cookieParams = array('httponly' => true);
     if (($defaultCookieDomain = craft()->config->get('defaultCookieDomain')) !== '') {
         $cookieParams['domain'] = $defaultCookieDomain;
     }
     $secureCookies = craft()->config->get('useSecureCookies');
     // If it's set to auto and a secure connection or it's set to true, set the secure flag.
     if ($secureCookies === 'auto' && craft()->request->isSecureConnection() || $secureCookies === true) {
         $cookieParams['secure'] = true;
     }
     // Set the PHP session cookie to HTTP only.
     $this->setCookieParams($cookieParams);
     // Check if the config value has actually been set to true/false
     $configVal = craft()->config->get('overridePhpSessionLocation');
     // If it's set to true, override the PHP save session path.
     if (is_bool($configVal) && $configVal === true) {
         $this->setSavePath(craft()->path->getSessionPath());
     } else {
         if ($configVal !== false) {
             if (mb_strpos($this->getSavePath(), 'tcp://') === false) {
                 $this->setSavePath(craft()->path->getSessionPath());
             }
         }
     }
     parent::init();
 }
 /**
  * Initializes the application component.
  * This method overrides the parent implementation by checking if cache is available.
  */
 public function init()
 {
     $this->_cache = Yii::app()->getComponent($this->cacheID);
     if (!$this->_cache instanceof ICache) {
         throw new CException(Yii::t('yii', 'CCacheHttpSession.cacheID is invalid. Please make sure "{id}" refers to a valid cache application component.', array('{id}' => $this->cacheID)));
     }
     parent::init();
 }
 /**
  *
  */
 public function init()
 {
     // Check if the config value has actually been set to true/false
     $configVal = craft()->config->get('overridePHPSessionLocation');
     // If it's set to true, override the PHP save session path.
     if (is_bool($configVal) && $configVal === true) {
         $this->setSavePath(craft()->path->getSessionPath());
     } else {
         if ($configVal !== false) {
             if (strpos($this->getSavePath(), 'tcp://') === false) {
                 $this->setSavePath(craft()->path->getSessionPath());
             }
         }
     }
     parent::init();
 }
 /**
  * Initializes the application component.
  *
  * @return null
  */
 public function init()
 {
     $cookieParams = array('httponly' => true);
     if (($defaultCookieDomain = craft()->config->get('defaultCookieDomain')) !== '') {
         $cookieParams['domain'] = $defaultCookieDomain;
     }
     // Set the PHP session cookie to HTTP only.
     $this->setCookieParams($cookieParams);
     // Check if the config value has actually been set to true/false
     $configVal = craft()->config->get('overridePHPSessionLocation');
     // If it's set to true, override the PHP save session path.
     if (is_bool($configVal) && $configVal === true) {
         $this->setSavePath(craft()->path->getSessionPath());
     } else {
         if ($configVal !== false) {
             if (mb_strpos($this->getSavePath(), 'tcp://') === false) {
                 $this->setSavePath(craft()->path->getSessionPath());
             }
         }
     }
     parent::init();
 }
Beispiel #5
0
 /**
  * 获取session对像
  *
  * @return CHttpSession
  */
 public function getSession()
 {
     if (!isset($this->components['session'])) {
         $session = new CHttpSession();
         $session->init();
         $this->components['session'] = $session;
     }
     return $this->components['session'];
 }
 /**
  * Initializes the route.
  * This method is invoked after the route is created by the route manager.
  */
 public function init()
 {
     $this->setCollection($this->collectionName);
     $this->_options = array('fsync' => $this->fsync, 'safe' => $this->safe);
     parent::init();
 }
Beispiel #7
0
 /**
  * Initializes the application component.
  * This method overrides the parent implementation by checking if redis is available.
  */
 public function init()
 {
     $this->getConnection();
     parent::init();
 }
 /**
  * Initializes the route.
  * This method is invoked after the route is created by the route manager.
  */
 public function init()
 {
     $this->collection = Yii::app()->edmsMongoCollection($this->collectionName, $this->dbName, $this->connectionId);
     $this->options = array('fsync' => $this->fsync, 'safe' => $this->safe);
     if (!is_null($this->timeout)) {
         $this->options['timeout'] = $this->timeout;
     }
     parent::init();
 }
 /**
  * Initializes the route.
  * This method is invoked after the route is created by the route manager.
  */
 public function init()
 {
     $connection = new Mongo($this->connectionString);
     $dbName = $this->dbName;
     $collectionName = $this->collectionName;
     $this->collection = $connection->{$dbName}->{$collectionName};
     $this->options = array('fsync' => $this->fsync, 'safe' => $this->safe);
     if (!is_null($this->mongoTimeout)) {
         $this->options['timeout'] = $this->mongoTimeout;
     }
     parent::init();
 }
 public function init()
 {
     $this->cacheSessionHandler->init();
     Yii::log('initialized cache session handler in zurmosession', CLogger::LEVEL_TRACE, 'session');
     parent::init();
 }