Horde_SessionHandler
in package
This class provides the interface to the session storage backend.
Copyright 2002-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Tags
Table of Contents
Properties
- $changed : bool
- If true, indicates the session data has changed.
- $_connected : bool
- Has a connection been made to the backend?
- $_logger : Horde_Log_Logger
- A logger instance.
- $_params : array<string|int, mixed>
- Configuration parameters.
- $_sig : string
- Initial session data signature.
- $_storage : Horde_SessionHandler_Storage
- The storage object.
Methods
- __construct() : mixed
- Constructor.
- __destruct() : mixed
- Destructor.
- close() : bool
- Close the backend.
- destroy() : bool
- Destroy the data for a particular session identifier in the backend.
- gc() : bool
- Garbage collect stale sessions from the backend.
- getSessionIDs() : array<string|int, mixed>
- Get a list of the valid session identifiers.
- getSessionsInfo() : array<string|int, mixed>
- Returns a list of authenticated users and data about their session.
- open() : bool
- Open the backend.
- read() : string
- Read the data for a particular session identifier from the backend.
- write() : bool
- Write session data to the backend.
Properties
$changed
If true, indicates the session data has changed.
public
bool
$changed
= \false
$_connected
Has a connection been made to the backend?
protected
bool
$_connected
= \false
$_logger
A logger instance.
protected
Horde_Log_Logger
$_logger
$_params
Configuration parameters.
protected
array<string|int, mixed>
$_params
= array()
$_sig
Initial session data signature.
protected
string
$_sig
$_storage
The storage object.
protected
Horde_SessionHandler_Storage
$_storage
Methods
__construct()
Constructor.
public
__construct(Horde_SessionHandler_Storage $storage[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $storage : Horde_SessionHandler_Storage
-
The storage object.
- $params : array<string|int, mixed> = array()
-
Configuration parameters:
- logger: (Horde_Log_Logger) A logger instance. DEFAULT: No logging - no_md5: (boolean) If true, does not do MD5 signatures of the session to determine if the session has changed (calling code is responsible for marking $changed as true when the session data has changed). DEFAULT: false - noset: (boolean) If true, don't set the save handler. DEFAULT: false - parse: (callback) A callback function that parses session information into an array. Is passed the raw session data as the only argument; expects either false or an array of session data as a return. DEFAULT: No
__destruct()
Destructor.
public
__destruct() : mixed
close()
Close the backend.
public
close() : bool
Return values
bool —True on success, false otherwise.
destroy()
Destroy the data for a particular session identifier in the backend.
public
destroy(string $id) : bool
This method should only be called internally by PHP via session_set_save_handler().
Parameters
- $id : string
-
The session identifier.
Return values
bool —True on success, false otherwise.
gc()
Garbage collect stale sessions from the backend.
public
gc([int $maxlifetime = 300 ]) : bool
This method should only be called internally by PHP via session_set_save_handler().
Parameters
- $maxlifetime : int = 300
-
The maximum age of a session.
Return values
bool —True on success, false otherwise.
getSessionIDs()
Get a list of the valid session identifiers.
public
getSessionIDs() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —A list of valid session identifiers.
getSessionsInfo()
Returns a list of authenticated users and data about their session.
public
getSessionsInfo() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —For authenticated users, the sessionid as a key and the session information as value. If no parsing function was provided, will always return an empty array.
open()
Open the backend.
public
open([string $save_path = null ][, string $session_name = null ]) : bool
Parameters
- $save_path : string = null
-
The path to the session object.
- $session_name : string = null
-
The name of the session.
Return values
bool —True on success, false otherwise.
read()
Read the data for a particular session identifier from the backend.
public
read(string $id) : string
This method should only be called internally by PHP via session_set_save_handler().
Parameters
- $id : string
-
The session identifier.
Return values
string —The session data.
write()
Write session data to the backend.
public
write(string $id, string $session_data) : bool
This method should only be called internally by PHP via session_set_save_handler().
Parameters
- $id : string
-
The session identifier.
- $session_data : string
-
The session data.
Return values
bool —True on success, false otherwise.