Exemplo n.º 1
0
 /**
  * Runtime and handlers settings before starting the session.
  *
  * @return $this
  */
 protected function setup()
 {
     // set gc max lifetime
     ini_set('session.gc_maxlifetime', intval($this->handler->getConfig('lifetime')));
     // set session cookie accessible via http only
     ini_set('session.cookie_httponly', 1);
     // register respective handler methods
     session_set_save_handler($this->handler, true);
     return $this;
 }
Exemplo n.º 2
0
 /**
  * Session database class constructor.
  *
  * @param App $app
  * @param array $config
  * @return boolean
  */
 public function __construct(App $app, array $config = [])
 {
     parent::__construct($app, $config);
     $this->table = $this->getConfig('table');
     $this->readSlave = $this->getConfig('readSlave') === true;
     // instantiate db instance
     if (!$this->db instanceof Trace) {
         $this->db = new Trace();
     }
     // persist master driver
     if (empty($this->masterDriver)) {
         $this->masterDriver = $this->db->getConnectionInstance()->getMasterDriver();
     }
     return true;
 }