SessionHandlerDB class

Session handler for storing sessions to database

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the SessionHandlerDB class also inherits all the methods and properties of: WireSessionHandler, WireData and Wire.

Show class?     Show args?       Only hookable?    

Common

NameReturnSummary 
SessionHandlerDB::destroy(string $id)
bool

Destroy the session indicated by the given session ID

 
SessionHandlerDB::gc(int $seconds)
bool

Garbage collection: remove stale sessions

 
SessionHandlerDB::getModuleConfigInputfields(array $data)
InputfieldWrapper

Session configuration options

 
SessionHandlerDB::getModuleInfo()
None 
SessionHandlerDB::getNumSessions()
int

Return the number of active sessions in the last 5 mins (300 seconds)

 
SessionHandlerDB::getSessionData($sessionID)
array

Return all session data for the given session ID

 
SessionHandlerDB::getSessions()
array

Get the most recent sessions

 
SessionHandlerDB::hookLoginSuccess(HookEvent $event)
None

Hook called after Session::loginSuccess to enforce the noPS option

 
SessionHandlerDB::init()
None 
SessionHandlerDB::install()
None

Install sessions table

SessionHandlerDB::read(string $id)
string

Read and return data for session indicated by $id

 
SessionHandlerDB::uninstall()
None

Drop sessions table

SessionHandlerDB::upgrade(int $fromVersion, int $toVersion)
None

Upgrade module version

SessionHandlerDB::wired()
None 
SessionHandlerDB::write(string $id, string $data)
bool

Write the given $data for the given session ID

 

Properties

NameReturnSummary 
SessionHandlerDB::lockSeconds int Max number of seconds to wait to obtain DB row lock. 
SessionHandlerDB::noPS int bool Prevent more than one session per logged-in user? 
SessionHandlerDB::retrySeconds int Seconds after which to retry after a lock fail. 
SessionHandlerDB::useIP int bool Track IP address? 
SessionHandlerDB::useUA int bool Track user agent? 

Additional methods and properties

In addition to the methods and properties above, SessionHandlerDB also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.252