CI_Session_driver::__construct PHP Method

__construct() public method

Class constructor
public __construct ( array &$params ) : void
$params array Configuration parameters
return void
    public function __construct(&$params)
    {
        $this->_config =& $params;
        if (is_php('7')) {
            $this->_success = TRUE;
            $this->_failure = FALSE;
        } else {
            $this->_success = 0;
            $this->_failure = -1;
        }
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Class constructor
  *
  * @param	array	$params	Configuration parameters
  * @return	void
  */
 public function __construct(&$params)
 {
     parent::__construct($params);
     if (empty($this->_config['save_path'])) {
         log_message('error', 'Session: No Redis save path configured.');
     } elseif (preg_match('#^unix://([^\\?]+)(?<options>\\?.+)?$#', $this->_config['save_path'], $matches)) {
         $save_path = array('path' => $matches[1]);
     } elseif (preg_match('#(?:tcp://)?([^:?]+)(?:\\:(\\d+))?(?<options>\\?.+)?#', $this->_config['save_path'], $matches)) {
         $save_path = array('host' => $matches[1], 'port' => empty($matches[2]) ? NULL : $matches[2]);
     } else {
         log_message('error', 'Session: Invalid Redis save path format: ' . $this->_config['save_path']);
     }
     if (isset($save_path)) {
         if (isset($matches['options'])) {
             $save_path['password'] = preg_match('#auth=([^\\s&]+)#', $matches['options'], $match) ? $match[1] : NULL;
             $save_path['database'] = preg_match('#database=(\\d+)#', $matches['options'], $match) ? (int) $match[1] : NULL;
             $save_path['timeout'] = preg_match('#timeout=(\\d+\\.\\d+)#', $matches['options'], $match) ? (double) $match[1] : NULL;
             preg_match('#prefix=([^\\s&]+)#', $matches['options'], $match) && ($this->_key_prefix = $match[1]);
         }
         $this->_config['save_path'] = $save_path;
         if ($this->_config['match_ip'] === TRUE) {
             $this->_key_prefix .= $_SERVER['REMOTE_ADDR'] . ':';
         }
     }
 }
All Usage Examples Of CI_Session_driver::__construct