\CodeIgniter\Session\HandlersDatabaseHandler

Session handler using current Database for storage

Summary

Methods
Properties
Constants
__construct()
setLogger()
open()
read()
write()
close()
destroy()
gc()
No public properties found
No constants found
destroyCookie()
lockSession()
releaseLock()
fail()
$fingerprint
$lock
$cookiePrefix
$cookieDomain
$cookiePath
$cookieSecure
$cookieName
$matchIP
$sessionID
$savePath
$ipAddress
$logger
$DBGroup
$table
$db
$platform
$rowExists
N/A
No private methods found
No private properties found
N/A

Properties

$fingerprint

$fingerprint : boolean

The Data fingerprint.

Type

boolean

$lock

$lock : mixed

Lock placeholder.

Type

mixed

$cookiePrefix

$cookiePrefix : string

Cookie prefix

Type

string

$cookieDomain

$cookieDomain : string

Cookie domain

Type

string

$cookiePath

$cookiePath : string

Cookie path

Type

string

$cookieSecure

$cookieSecure : boolean

Cookie secure?

Type

boolean

$cookieName

$cookieName : string

Cookie name to use

Type

string

$matchIP

$matchIP : boolean

Match IP addresses for cookies?

Type

boolean

$sessionID

$sessionID : string

Current session ID

Type

string

$savePath

$savePath : string

The 'save path' for the session varies between

Type

string

$ipAddress

$ipAddress : string

User's IP address.

Type

string

$DBGroup

$DBGroup : string

The database group to use for storage.

Type

string

$table

$table : string

The name of the table to store session info.

Type

string

$platform

$platform : string

The database type, for locking purposes.

Type

string

$rowExists

$rowExists : boolean

Row exists flag

Type

boolean

Methods

__construct()

__construct(\CodeIgniter\Config\BaseConfig  $config, string  $ipAddress) 

Constructor

Parameters

\CodeIgniter\Config\BaseConfig $config
string $ipAddress

open()

open(string  $savePath, string  $name) : boolean

Open

Ensures we have an initialized database connection.

Parameters

string $savePath

Path to session files' directory

string $name

Session cookie name

Throws

\Exception

Returns

boolean

read()

read(string  $sessionID) : string

Read

Reads session data and acquires a lock

Parameters

string $sessionID

Session ID

Returns

string —

Serialized session data

write()

write(string  $sessionID, string  $sessionData) : boolean

Write

Writes (create / update) session data

Parameters

string $sessionID

Session ID

string $sessionData

Serialized session data

Returns

boolean

close()

close() : boolean

Close

Releases locks and closes file descriptor.

Returns

boolean

destroy()

destroy(string  $sessionID) : boolean

Destroy

Destroys the current session.

Parameters

string $sessionID

Returns

boolean

gc()

gc(integer  $maxlifetime) : boolean

Garbage Collector

Deletes expired sessions

Parameters

integer $maxlifetime

Maximum lifetime of sessions

Returns

boolean

destroyCookie()

destroyCookie() : boolean

Internal method to force removal of a cookie by the client when session_destroy() is called.

Returns

boolean

lockSession()

lockSession(string  $sessionID) : boolean

Lock the session.

Parameters

string $sessionID

Returns

boolean

releaseLock()

releaseLock() : boolean

Releases the lock, if any.

Returns

boolean

fail()

fail() : boolean

Fail

Drivers other than the 'files' one don't (need to) use the session.save_path INI setting, but that leads to confusing error messages emitted by PHP when open() or write() fail, as the message contains session.save_path ... To work around the problem, the drivers will call this method so that the INI is set just in time for the error message to be properly generated.

Returns

boolean