Class

ezpSessionHandler

abstract class ezpSessionHandler

Abstract session handler class to extend

CALLBACKS: destroy, gc, regenerate & cleanup functions MUST implement callbacks. Definition is documented in functions on this class, examples can be found in the handlers and examples of use can be sessin in ezsession.php class doc section.

Methods

__construct(bool $userHasCookie = false)

__construct

bool isConnected()

Checks if session handler is connected with backend.

bool setSaveHandler()

Set it self as save handler

bool open(string $savePath, string $sessionName)

Session open handler

bool close()

Session close handler

string|false read(string $sessionId)

Session read handler

bool write(string $sessionId, string $sessionData)

Session write handler

bool destroy(string $sessionId)

Session destroy handler Callback: "destroy_[pre|post]" eZDB $db string $sessionId string $escKey

bool regenerate(bool $updateBackendData = true)

Regenerate session id Callback (when $updateBackendData is true): "regenerate_[pre|post]" eZDB $db string $escNewKey string $escOldKey int $escUserID

bool gc(int $maxLifeTime)

Session gc (garbageCollector) handler Callback: "gc_[pre|post]" eZDB $db int $maxLifeTime

bool cleanup()

Remove all session data Callback: "cleanup_[pre|post]" eZDB $db

deleteByUserIDs(array $userIDArray)

Remove all session data for a specific user

static int count()

Counts the number of session and returns it.

static bool hasBackendAccess()

Signals that handler has direct access to backend, thus is cable of supporting features like gc, cleanup, delete & count.

static bool dbRequired()

Signals that handler requires db instance

bool sessionStart()

Starts the session.

Details

at line 31
public __construct(bool $userHasCookie = false)

__construct

Parameters

bool $userHasCookie

at line 41
public bool isConnected()

Checks if session handler is connected with backend.

Return Value

bool

at line 51
public bool setSaveHandler()

Set it self as save handler

Return Value

bool

at line 72
public bool open(string $savePath, string $sessionName)

Session open handler

Parameters

string $savePath
string $sessionName

Return Value

bool

at line 82
public bool close()

Session close handler

Return Value

bool

at line 93
abstract public string|false read(string $sessionId)

Session read handler

Parameters

string $sessionId

Return Value

string|false Binary session data

at line 102
abstract public bool write(string $sessionId, string $sessionData)

Session write handler

Parameters

string $sessionId
string $sessionData Binary session data

Return Value

bool

at line 114
abstract public bool destroy(string $sessionId)

Session destroy handler Callback: "destroy_[pre|post]" eZDB $db string $sessionId string $escKey

Parameters

string $sessionId

Return Value

bool

at line 127
abstract public bool regenerate(bool $updateBackendData = true)

Regenerate session id Callback (when $updateBackendData is true): "regenerate_[pre|post]" eZDB $db string $escNewKey string $escOldKey int $escUserID

Parameters

bool $updateBackendData True if we want to keep session data with the new session id

Return Value

bool

at line 138
abstract public bool gc(int $maxLifeTime)

Session gc (garbageCollector) handler Callback: "gc_[pre|post]" eZDB $db int $maxLifeTime

Parameters

int $maxLifeTime In seconds

Return Value

bool

at line 147
abstract public bool cleanup()

Remove all session data Callback: "cleanup_[pre|post]" eZDB $db

Return Value

bool

at line 154
abstract public deleteByUserIDs(array $userIDArray)

Remove all session data for a specific user

Parameters

array $userIDArray

at line 161
static public int count()

Counts the number of session and returns it.

Return Value

int Returns -1 if handler does not support this.

at line 172
static public bool hasBackendAccess()

Signals that handler has direct access to backend, thus is cable of supporting features like gc, cleanup, delete & count.

Return Value

bool

at line 182
static public bool dbRequired()

Signals that handler requires db instance

Return Value

bool

at line 194
public bool sessionStart()

Starts the session.

Override this method if you need to delegate session start to an external system (e.g. Symfony stack in eZ Publish 5)

Return Value

bool