Ejemplo n.º 1
0
 /**
  * Create a new session and copy variables from the old one
  *
  * @return  boolean $result true on success
  *
  * @since   11.1
  */
 public function fork()
 {
     if ($this->_state !== 'active') {
         // @TODO :: generated error here
         return false;
     }
     // Keep session config
     $cookie = session_get_cookie_params();
     // Kill session
     $this->_handler->clear();
     // Re-register the session store after a session has been destroyed, to avoid PHP bug
     $this->_store->register();
     // Restore config
     session_set_cookie_params($cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure'], true);
     // Restart session with new id
     $this->_handler->regenerate(true, null);
     $this->_handler->start();
     return true;
 }
Ejemplo n.º 2
0
 /**
  * Frees all session variables and destroys all data registered to a session
  *
  * This method resets the data pointer and destroys all of the data associated
  * with the current session in its storage. It forces a new session to be
  * started after this method is called. It does not unset the session cookie.
  *
  * @return  boolean  True on success
  *
  * @see     session_destroy()
  * @see     session_unset()
  * @since   11.1
  */
 public function destroy()
 {
     // Session was already destroyed
     if ($this->_state === 'destroyed') {
         return true;
     }
     // Kill session
     $this->_handler->clear();
     // Create new data storage
     $this->data = new \Joomla\Registry\Registry();
     $this->_state = 'destroyed';
     return true;
 }