VuFind API Documentation

AbstractBase
in package
implements HandlerInterface Uses DbTableAwareTrait, DbServiceAwareTrait

Base class for session handling

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

author

Sebastian Kehr kehr@ub.uni-leipzig.de

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

Interfaces, Classes, Traits and Enums

HandlerInterface
Session handler interface

Table of Contents

$dbServiceManager  : PluginManager
Database service plugin manager
$lifetime  : int
Session lifetime in seconds
$tableManager  : PluginManager
Database table plugin manager
$writesDisabled  : bool
Whether writes are disabled, i.e. any changes to the session are not written to the storage
__construct()  : mixed
Constructor
close()  : bool
Close function, this works like a destructor in classes and is executed when the session operation is done.
destroy()  : bool
The destroy handler, this is executed when a session is destroyed with session_destroy() and takes the session id as its only parameter.
disableWrites()  : void
Disable session writing, i.e. make it read-only
enableWrites()  : void
Enable session writing (default)
gc()  : bool
The garbage collector, this is executed when the session garbage collector is executed and takes the max session lifetime as its only parameter.
getDbService()  : T
Get a database service object.
getDbServiceManager()  : PluginManager
Get the service plugin manager. Throw an exception if it is missing.
getDbTable()  : Gateway
Get a database table object.
getDbTableManager()  : PluginManager
Get the table plugin manager. Throw an exception if it is missing.
open()  : bool
Open function, this works like a constructor in classes and is executed when the session is being opened.
setDbServiceManager()  : void
Set the service plugin manager.
setDbTableManager()  : void
Set the table plugin manager.
write()  : bool
Write function that is called when session data is to be saved.
saveSession()  : bool
A function that is called internally when session data is to be saved.

Properties

$lifetime

Session lifetime in seconds

protected int $lifetime = 3600

$writesDisabled

Whether writes are disabled, i.e. any changes to the session are not written to the storage

protected bool $writesDisabled = false

Methods

__construct()

Constructor

public __construct([Config $config = null ]) : mixed
Parameters
$config : Config = null

Session configuration ([Session] section of config.ini)

Return values
mixed

close()

Close function, this works like a destructor in classes and is executed when the session operation is done.

public close() : bool
Return values
bool

destroy()

The destroy handler, this is executed when a session is destroyed with session_destroy() and takes the session id as its only parameter.

public destroy(string $sessId) : bool

IMPORTANT: The functionality defined in this method is global to all session mechanisms. If you override this method, be sure to still call parent::destroy() in addition to any new behavior.

Parameters
$sessId : string

The session ID to destroy

Return values
bool

disableWrites()

Disable session writing, i.e. make it read-only

public disableWrites() : void
Return values
void

enableWrites()

Enable session writing (default)

public enableWrites() : void
Return values
void

gc()

The garbage collector, this is executed when the session garbage collector is executed and takes the max session lifetime as its only parameter.

public gc(int $sessMaxLifetime) : bool
Parameters
$sessMaxLifetime : int

Maximum session lifetime.

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
bool

getDbService()

Get a database service object.

public getDbService(class-string<\VuFind\Db\Service\T> $name) : T
Parameters
$name : class-string<\VuFind\Db\Service\T>

Name of service to retrieve

Tags
template

T

Return values
T

getDbTable()

Get a database table object.

public getDbTable(string $table) : Gateway
Parameters
$table : string

Table to load.

Return values
Gateway

open()

Open function, this works like a constructor in classes and is executed when the session is being opened.

public open(string $sess_path, string $sess_name) : bool
Parameters
$sess_path : string

Session save path

$sess_name : string

Session name

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
bool

write()

Write function that is called when session data is to be saved.

public write(string $sessId, string $data) : bool
Parameters
$sessId : string

The current session ID

$data : string

The session data to write

Return values
bool

saveSession()

A function that is called internally when session data is to be saved.

protected abstract saveSession(string $sessId, string $data) : bool
Parameters
$sessId : string

The current session ID

$data : string

The session data to write

Return values
bool

Search results