WkxDbSessionHandler
in package
implements
SessionHandlerInterface, SessionIdInterface, SessionUpdateTimestampHandlerInterface
Custom session handler used when the session is stored inside db
WARNING: NEVER DUPLICATE THIS CODE.
This code is called by PHP's internal session management mechanism. The 'session' table should not be manipulated through direct database access anywhere other than this special class.
The only exception is the UPDATEDATABASE update class, which starts its own PHP session stored in a file, not in this table. This allows for maintenance operations during installations and updates.
Tags
Table of Contents
Interfaces
- SessionHandlerInterface
- SessionIdInterface
- SessionUpdateTimestampHandlerInterface
Methods
- close() : bool
- Close the session
- create_sid() : string
- Creates a new session ID
- destroy() : bool
- Destroy a session
- gc() : int|false
- Cleanup old sessions
- open() : bool
- Initialize session
- read() : string|false
- Read session data
- updateTimestamp() : bool
- Updates the last modification timestamp of the session
- validateId() : bool
- Validates a given session ID
- write() : bool
- Write session data
Methods
close()
Close the session
public
close() : bool
Tags
Return values
boolcreate_sid()
Creates a new session ID
public
create_sid() : string
This function is automatically executed when a new session ID needs to be created.
NB : replicate the behavior of PHP C code with PHP pure code.
Tags
Return values
stringdestroy()
Destroy a session
public
destroy(string $id) : bool
Parameters
- $id : string
-
The session ID being destroyed
Tags
Return values
boolgc()
Cleanup old sessions
public
gc(int $max_lifetime) : int|false
Parameters
- $max_lifetime : int
-
Sessions that have not updated for the last max_lifetime seconds will be removed
Tags
Return values
int|falseopen()
Initialize session
public
open(string $path, string $name) : bool
Parameters
- $path : string
-
The path where to store/retrieve the session
- $name : string
-
The session name
Tags
Return values
boolread()
Read session data
public
read(string $id) : string|false
Parameters
- $id : string
-
The session id to read data for
Tags
Return values
string|falseupdateTimestamp()
Updates the last modification timestamp of the session
public
updateTimestamp(string $id, string $data) : bool
Parameters
- $id : string
-
The session ID
- $data : string
-
The session data
Tags
Return values
boolvalidateId()
Validates a given session ID
public
validateId(string $id) : bool
NB : this function is actually more secure that PHP defaults because the session ID is really checked!
Parameters
- $id : string
-
The session ID
Tags
Return values
boolwrite()
Write session data
public
write(string $id, string $data) : bool
Parameters
- $id : string
-
The session id
- $data : string
-
The encoded session data