You are here

class SessionProxy_Backend_Native in Session Proxy 7

Native implementation of session backend: use PHP native session handling. Using it allows to use built-in extensions session handling, such as Redis or Memcache extensions features, which are known to be really fast.

Hierarchy

Expanded class hierarchy of SessionProxy_Backend_Native

1 string reference to 'SessionProxy_Backend_Native'
drupal_session_initialize in ./session.inc
Initializes the session handler.

File

lib/SessionProxy/Backend/Native.php, line 8

View source
class SessionProxy_Backend_Native extends SessionProxy_Backend_Base {
  protected function getSessionUid() {
    return isset($_SESSION['uid']) ? $_SESSION['uid'] : NULL;
  }
  public function writeDisable() {
  }
  public function writeEnable() {
  }
  public function isWriteEnabled() {
    return TRUE;
  }
  public function regenerate() {
    global $user;
    if (!$this
      ->sessionIsEmpty()) {
      $currentData = $_SESSION;
    }
    if ($this->started) {
      $this
        ->destroy();
    }
    $this
      ->generateSessionIdentifier();
    if (isset($currentData) && !empty($currentData)) {
      $_SESSION = $currentData;
      $this
        ->start();
      if ($user->uid) {
        $_SESSION['uid'] = $user->uid;
      }
    }
    else {
      if ($user->uid) {
        $this
          ->start();
        $_SESSION['uid'] = $user->uid;
      }
    }
    if ($this->started) {

      // Some PHP versions won't reset correctly the cookie.
      $params = session_get_cookie_params();
      $expire = $params['lifetime'] ? REQUEST_TIME + $params['lifetime'] : 0;
      setcookie($this->sessionName, $this->sessionIdentifier, $expire, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
    }
    $this
      ->refreshAfterSessionChange();
  }
  public function destroyAllForUser($uid) {
    return;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SessionProxy_Backend_Base::$httpsEnabled protected property
SessionProxy_Backend_Base::$sessionIdentifier protected property
SessionProxy_Backend_Base::$sessionName protected property
SessionProxy_Backend_Base::$sessionNameUnsecure protected property
SessionProxy_Backend_Base::$started protected property
SessionProxy_Backend_Base::$userAccessUpdated protected property
SessionProxy_Backend_Base::commit public function Called during shutdown hook time, this allows you to perform additional operations outside of the core PHP session handling at the end of request. Overrides SessionProxy_Backend_Interface::commit
SessionProxy_Backend_Base::deleteCurrentSessionCookie public function Delete current session cookie Overrides SessionProxy_Backend_Interface::deleteCurrentSessionCookie
SessionProxy_Backend_Base::destroy public function Destroy session if any Overrides SessionProxy_Backend_Interface::destroy 1
SessionProxy_Backend_Base::generateSessionIdentifier protected function Generate new session identifier, set it as PHP session identifier and return it.
SessionProxy_Backend_Base::handleHttps public function Does this instance handle HTTPS diverging session name. Overrides SessionProxy_Backend_Interface::handleHttps 1
SessionProxy_Backend_Base::isStarted public function Is session started. Overrides SessionProxy_Backend_Interface::isStarted
SessionProxy_Backend_Base::refreshAfterSessionChange protected function Refresh various information of the object right after session state change.
SessionProxy_Backend_Base::sessionIsEmpty protected function Is the current session is empty.
SessionProxy_Backend_Base::start public function Start session. Overrides SessionProxy_Backend_Interface::start
SessionProxy_Backend_Base::updateUser protected function Refresh global user data following the actual session state.
SessionProxy_Backend_Base::__construct public function Default constructor. 1
SessionProxy_Backend_Native::destroyAllForUser public function Native implementation is opaque, and cannot allow us to index session: it is impossible to proceed with this cleaning. Overrides SessionProxy_Backend_Base::destroyAllForUser
SessionProxy_Backend_Native::getSessionUid protected function Get the actual logged in user user identifier if any. Overrides SessionProxy_Backend_Base::getSessionUid
SessionProxy_Backend_Native::isWriteEnabled public function Is session write enabled. Overrides SessionProxy_Backend_Interface::isWriteEnabled
SessionProxy_Backend_Native::regenerate public function Regenerate the current session. Overrides SessionProxy_Backend_Interface::regenerate
SessionProxy_Backend_Native::writeDisable public function Enable session writing explicitely. Overrides SessionProxy_Backend_Interface::writeDisable
SessionProxy_Backend_Native::writeEnable public function Disable session writing explicitely. Overrides SessionProxy_Backend_Interface::writeEnable