Documentation

Core_Session_Database extends Core_Session
in package

Database Sessions

Tags
subpackage

Core

version
7.x
author

Hostmake LLC

copyright

© 2005-2022 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru

Table of Contents

$_cookieLifetime  : int
Cookie Lifetime, default 31536000
$_dataBase  : Core_DataBase
DataBase instance
$_debug  : bool
Debug
$_domain  : string
Domain, auto-detected by default
$_error  : mixed
Error
$_getLockTimeout  : int
GET_LOCK timeout (sec)
$_handler  : mixed
Handler
$_hasSessionId  : mixed
Is the current request has sent the session ID.
$_lockPrefix  : string
Lock prefix
$_lockTimeout  : int
Lock timeout
$_maxlifetime  : int
Session maxlifetime
$_nextStepDelay  : int
Next step delay (microseconds) Default 0,5 sec - 500000 microseconds
$_read  : bool
Session has been read
$_started  : bool
Session has been started
__construct()  : mixed
Constructor.
close()  : bool
Close session
cookieLifetime()  : mixed
Set Cookie Lifetime
debug()  : mixed
Set debug
destroy()  : bool
Destroy Session
domain()  : mixed
Set Domain
flushAll()  : mixed
Delete all sessions from database
getMaxLifeTime()  : int
Get session maxlifetime
getName()  : string
Get session name
hasSessionId()  : bool
The is the current request has sent the session ID.
isAcive()  : bool
Backward compatibility, see isActive()
isActive()  : bool
Checks if the session enabled and exists
isStarted()  : bool
Checks if the session was started
regenerateId()  : mixed
Regenerate session ID
sessionClose()  : bool
The close callback works like a destructor in classes and is executed after the session write callback has been called.
sessionDestroyer()  : bool
This callback is executed when a session is destroyed with session_destroy()
sessionGc()  : bool
The garbage collector callback is invoked internally by PHP periodically in order to purge old session data.
sessionMaxlifetime()  : bool
This callback is executed when a session sets maxlifetime
sessionOpen()  : bool
The open callback works like a constructor in classes and is executed when the session is being opened.
sessionRead()  : string
The read callback must always return a session encoded (serialized) string, or an empty string if there is no data to read.
sessionWrite()  : bool
The write callback is called when the session needs to be saved and closed.
setMaxLifeTime()  : true
Set session maxlifetime
start()  : bool
Start session
_error()  : mixed
Show error
_getDriverName()  : srting
Get full driver name
_getLockName()  : string
Get LOCK name
_lock()  : bool
Lock session
_log()  : mixed
Log
_setSessionHandler()  : mixed
Registers session handler
_unlock()  : bool
Unlock session

Properties

$_cookieLifetime

Cookie Lifetime, default 31536000

protected static int $_cookieLifetime = 31536000

$_debug

Debug

protected static bool $_debug = \FALSE

$_domain

Domain, auto-detected by default

protected static string $_domain = \NULL

$_error

Error

protected static mixed $_error = \NULL

$_getLockTimeout

GET_LOCK timeout (sec)

protected int $_getLockTimeout = 5

$_handler

Handler

protected static mixed $_handler = \NULL

$_hasSessionId

Is the current request has sent the session ID.

protected static mixed $_hasSessionId = \NULL

$_lockPrefix

Lock prefix

protected string $_lockPrefix = \NULL

$_lockTimeout

Lock timeout

protected int $_lockTimeout = 10

$_maxlifetime

Session maxlifetime

protected static int $_maxlifetime = \NULL

$_nextStepDelay

Next step delay (microseconds) Default 0,5 sec - 500000 microseconds

protected int $_nextStepDelay = 500000

$_read

Session has been read

protected bool $_read = \FALSE

$_started

Session has been started

protected static bool $_started = \FALSE

Methods

__construct()

Constructor.

public __construct() : mixed
Return values
mixed

close()

Close session

public static close() : bool
Return values
bool

cookieLifetime()

Set Cookie Lifetime

public static cookieLifetime(int $lifetime) : mixed
Parameters
$lifetime : int
Return values
mixed

debug()

Set debug

public static debug([bool $debug = TRUE ]) : mixed
Parameters
$debug : bool = TRUE
Return values
mixed

destroy()

Destroy Session

public static destroy(string $id) : bool
Parameters
$id : string

session ID

Return values
bool

domain()

Set Domain

public static domain(string $domain) : mixed
Parameters
$domain : string
Return values
mixed

flushAll()

Delete all sessions from database

public static flushAll() : mixed
Return values
mixed

getMaxLifeTime()

Get session maxlifetime

public static getMaxLifeTime() : int
Return values
int

getName()

Get session name

public static getName() : string
Return values
string

hasSessionId()

The is the current request has sent the session ID.

public static hasSessionId() : bool
Return values
bool

isAcive()

Backward compatibility, see isActive()

public static isAcive() : bool
Return values
bool

isActive()

Checks if the session enabled and exists

public static isActive() : bool
Return values
bool

isStarted()

Checks if the session was started

public static isStarted() : bool
Return values
bool

regenerateId()

Regenerate session ID

public static regenerateId([bool $delete_old_session = FALSE ]) : mixed
Parameters
$delete_old_session : bool = FALSE

Whether to delete the old associated session file or not, default FALSE

Return values
mixed

sessionClose()

The close callback works like a destructor in classes and is executed after the session write callback has been called.

public sessionClose() : bool
Return values
bool

sessionDestroyer()

This callback is executed when a session is destroyed with session_destroy()

public sessionDestroyer(string $id) : bool
Parameters
$id : string

session ID

Return values
bool

sessionGc()

The garbage collector callback is invoked internally by PHP periodically in order to purge old session data.

public sessionGc(string $maxlifetime) : bool
Parameters
$maxlifetime : string

max life time

Return values
bool

sessionMaxlifetime()

This callback is executed when a session sets maxlifetime

public sessionMaxlifetime(int $maxlifetime[, bool $overwrite = FALSE ]) : bool
Parameters
$maxlifetime : int
$overwrite : bool = FALSE

overwrite previous maxlifetime

Return values
bool

sessionOpen()

The open callback works like a constructor in classes and is executed when the session is being opened.

public sessionOpen(string $save_path, string $session_name) : bool
Parameters
$save_path : string

save path

$session_name : string

session name

Return values
bool

sessionRead()

The read callback must always return a session encoded (serialized) string, or an empty string if there is no data to read.

public sessionRead(string $id) : string
Parameters
$id : string

session ID

Return values
string

sessionWrite()

The write callback is called when the session needs to be saved and closed.

public sessionWrite(string $id, string $value) : bool
Parameters
$id : string

session ID

$value : string

data

Return values
bool

setMaxLifeTime()

Set session maxlifetime

public static setMaxLifeTime(int $maxlifetime[, bool $overwrite = FALSE ]) : true
Parameters
$maxlifetime : int
$overwrite : bool = FALSE

Overwrite maximum lifetime, default FALSE

Return values
true

start()

Start session

public static start() : bool
Return values
bool

_error()

Show error

protected static _error(string $content) : mixed
Parameters
$content : string
Return values
mixed

_getDriverName()

Get full driver name

protected static _getDriverName(string $driver) : srting
Parameters
$driver : string

driver name

Return values
srting

_getLockName()

Get LOCK name

protected _getLockName(int $id) : string
Parameters
$id : int

session ID

Return values
string

_lock()

Lock session

protected _lock(int $id) : bool
Parameters
$id : int

session ID

Return values
bool

_log()

Log

protected static _log(string $actionName) : mixed
Parameters
$actionName : string
Return values
mixed

_setSessionHandler()

Registers session handler

protected static _setSessionHandler() : mixed
Return values
mixed

_unlock()

Unlock session

protected _unlock(int $id) : bool
Parameters
$id : int

session ID

Return values
bool

Search results