You are here

abstract class SessionProxy_Storage_Base in Session Proxy 7

Hierarchy

Expanded class hierarchy of SessionProxy_Storage_Base

File

lib/SessionProxy/Storage/Base.php, line 3

View source
abstract class SessionProxy_Storage_Base implements SessionProxy_Storage_Interface {

  /**
   * @var array
   */
  protected $options;

  /**
   * @var bool
   */
  protected $isHttps;

  /**
   * @var string
   */
  protected $sessionName;

  /**
   * @var string
   */
  protected $sessionNameUnsecure;

  /**
   * @var string
   */
  protected $lastReadSessionId = NULL;

  /**
   * @var string
   */
  protected $lastReadValueHash = NULL;

  /**
   * @var int
   */
  protected $uid = NULL;

  /**
   * @var int
   */
  protected $uidHasChanged = FALSE;

  /**
   * Call this function at read time, it will allow you to check if the session
   * has changed or not and write it accordingly.
   *
   * @param string $sessionId
   * @param string $serializedData
   */
  protected function sessionDataSetHash($sessionId, $serializedData) {
    $this->lastReadSessionId = $sessionId;
    $this->lastReadValueHash = md5($serializedData);
  }

  /**
   * Does the session data has changed.
   *
   * @param string $sessionId
   * @param string $serializedData
   */
  protected function sessionDataHasChanged($sessionId, $serializedData) {
    global $user;
    return $this->uidHasChanged || $this->lastReadSessionId != $sessionId || md5($serializedData) != $this->lastReadValueHash || REQUEST_TIME - $user->timestamp > variable_get('session_write_interval', 180);
  }
  public function getSessionUid() {
    return $this->uid;
  }
  public function setSessionUid($uid) {
    $this->uidHasChanged = $this->uid != $uid;
    $this->uid = $uid;
  }
  public function __construct(array $options = array()) {
    global $is_https;
    $this->sessionName = session_name();
    $this->isHttps = $is_https;
    $this->options = $options;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SessionProxy_Storage_Base::$isHttps protected property
SessionProxy_Storage_Base::$lastReadSessionId protected property
SessionProxy_Storage_Base::$lastReadValueHash protected property
SessionProxy_Storage_Base::$options protected property
SessionProxy_Storage_Base::$sessionName protected property
SessionProxy_Storage_Base::$sessionNameUnsecure protected property
SessionProxy_Storage_Base::$uid protected property
SessionProxy_Storage_Base::$uidHasChanged protected property
SessionProxy_Storage_Base::getSessionUid public function Get the logged in user identifier, if any. In all cases, this will be called after read(); Overrides SessionProxy_Storage_Interface::getSessionUid
SessionProxy_Storage_Base::sessionDataHasChanged protected function Does the session data has changed.
SessionProxy_Storage_Base::sessionDataSetHash protected function Call this function at read time, it will allow you to check if the session has changed or not and write it accordingly.
SessionProxy_Storage_Base::setSessionUid public function When session has been regenerated, inform the storage backend that further session writing will be done for a new user identenfier. Overrides SessionProxy_Storage_Interface::setSessionUid
SessionProxy_Storage_Base::__construct public function 1
SessionProxy_Storage_Interface::close public function 2
SessionProxy_Storage_Interface::destroy public function 2
SessionProxy_Storage_Interface::destroyFor public function Destroy all known sessions using the given conditions. 2
SessionProxy_Storage_Interface::gc public function 2
SessionProxy_Storage_Interface::open public function 2
SessionProxy_Storage_Interface::read public function 2
SessionProxy_Storage_Interface::write public function 2