AbstractBase
in package
implements
HandlerInterface
Uses
DbTableAwareTrait, DbServiceAwareTrait
Base class for session handling
Tags
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() : int|false
- 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
$dbServiceManager
Database service plugin manager
protected
PluginManager
$dbServiceManager
$lifetime
Session lifetime in seconds
protected
int
$lifetime
= 3600
$tableManager
Database table plugin manager
protected
PluginManager
$tableManager
$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) : int|false
Parameters
- $sessMaxLifetime : int
-
Maximum session lifetime.
Tags
Return values
int|false —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
Return values
T —getDbServiceManager()
Get the service plugin manager. Throw an exception if it is missing.
public
getDbServiceManager() : PluginManager
Tags
Return values
PluginManager —getDbTable()
Get a database table object.
public
getDbTable(string $table) : Gateway
Parameters
- $table : string
-
Table to load.
Return values
Gateway —getDbTableManager()
Get the table plugin manager. Throw an exception if it is missing.
public
getDbTableManager() : PluginManager
Tags
Return values
PluginManager —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
Return values
bool —setDbServiceManager()
Set the service plugin manager.
public
setDbServiceManager(PluginManager $manager) : void
Parameters
- $manager : PluginManager
-
Plugin manager
Return values
void —setDbTableManager()
Set the table plugin manager.
public
setDbTableManager(PluginManager $manager) : void
Parameters
- $manager : PluginManager
-
Plugin manager
Return values
void —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