\Horde_SessionHandler

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.

Summary

Methods
Properties
Constants
__construct()
__destruct()
open()
close()
read()
write()
destroy()
gc()
getSessionIDs()
getSessionsInfo()
$changed
No constants found
No protected methods found
$_connected
$_logger
$_params
$_sig
$_storage
N/A
No private methods found
No private properties found
N/A

Properties

$changed

$changed : boolean

If true, indicates the session data has changed.

Type

boolean

$_connected

$_connected : boolean

Has a connection been made to the backend?

Type

boolean

$_logger

$_logger : \Horde_Log_Logger

A logger instance.

Type

\Horde_Log_Logger

$_params

$_params : array

Configuration parameters.

Type

array

$_sig

$_sig : string

Initial session data signature.

Type

string

Methods

__construct()

__construct(\Horde_SessionHandler_Storage  $storage, array  $params = array()) 

Constructor.

Parameters

\Horde_SessionHandler_Storage $storage

The storage object.

array $params

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()

__destruct() 

Destructor.

open()

open(string  $save_path = null, string  $session_name = null) : boolean

Open the backend.

Parameters

string $save_path

The path to the session object.

string $session_name

The name of the session.

Returns

boolean —

True on success, false otherwise.

close()

close() : boolean

Close the backend.

Returns

boolean —

True on success, false otherwise.

read()

read(string  $id) : string

Read the data for a particular session identifier from the backend.

This method should only be called internally by PHP via session_set_save_handler().

Parameters

string $id

The session identifier.

Returns

string —

The session data.

write()

write(string  $id, string  $session_data) : boolean

Write session data to the backend.

This method should only be called internally by PHP via session_set_save_handler().

Parameters

string $id

The session identifier.

string $session_data

The session data.

Returns

boolean —

True on success, false otherwise.

destroy()

destroy(string  $id) : boolean

Destroy the data for a particular session identifier in the backend.

This method should only be called internally by PHP via session_set_save_handler().

Parameters

string $id

The session identifier.

Returns

boolean —

True on success, false otherwise.

gc()

gc(integer  $maxlifetime = 300) : boolean

Garbage collect stale sessions from the backend.

This method should only be called internally by PHP via session_set_save_handler().

Parameters

integer $maxlifetime

The maximum age of a session.

Returns

boolean —

True on success, false otherwise.

getSessionIDs()

getSessionIDs() : array

Get a list of the valid session identifiers.

Throws

\Horde_SessionHandler_Exception

Returns

array —

A list of valid session identifiers.

getSessionsInfo()

getSessionsInfo() : array

Returns a list of authenticated users and data about their session.

Throws

\Horde_SessionHandler_Exception

Returns

array —

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.