class DatabaseStore extends BaseStore (View source)

Traits

Provides extensions to this object to integrate it with standard config API methods.

Constants

private HASH_ALGO

Hashing algorithm used to encrypt $session_id (PHPSESSID) Ensure that HybridSessionDataObject.SessionID is wide enough to accomodate the hash

Properties

protected string|null $key

Session secret key

from  BaseStore

Methods

public static 
config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

public
mixed
uninherited(string $name)

Gets the uninherited value for the given config option

public
void
setKey(string|null $key)

Assign a new session secret key

protected
string|null
getKey()

Get the session secret key

protected
int
getLifetime()

Get lifetime in number of seconds

protected
int
getNow()

Gets the current unix timestamp

protected
bool
isDatabaseReady()

Determine if the DB is ready to use.

public
bool
open(string $save_path, string $name)

No description

public
bool
close()

No description

public
string|false
read(string $session_id)

No description

public
bool
write(string $session_id, string $session_data)

No description

public
bool
destroy(string $session_id)

No description

public
int|false
gc(int $maxlifetime)

No description

public static 
string
binaryDataJsonEncode(string $data)

Encode binary data into ASCII string (a subset of UTF-8)

public static 
string|null
binaryDataJsonDecode(string $text)

Decode ASCII string into original binary data (a php string)

Details

static Config_ForClass config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

Return Value

Config_ForClass

mixed uninherited(string $name)

Gets the uninherited value for the given config option

Parameters

string $name

Return Value

mixed

void setKey(string|null $key)

Assign a new session secret key

Parameters

string|null $key

Return Value

void

protected string|null getKey()

Get the session secret key

Return Value

string|null

protected int getLifetime()

Get lifetime in number of seconds

Return Value

int

protected int getNow()

Gets the current unix timestamp

Return Value

int

protected bool isDatabaseReady()

Determine if the DB is ready to use.

Return Value

bool

Exceptions

Exception

bool open(string $save_path, string $name)

No description

Parameters

string $save_path
string $name

Return Value

bool

bool close()

No description

Return Value

bool

string|false read(string $session_id)

No description

Parameters

string $session_id

Return Value

string|false

bool write(string $session_id, string $session_data)

No description

Parameters

string $session_id
string $session_data

Return Value

bool

bool destroy(string $session_id)

No description

Parameters

string $session_id

Return Value

bool

int|false gc(int $maxlifetime)

No description

Parameters

int $maxlifetime

Return Value

int|false

static string binaryDataJsonEncode(string $data)

Encode binary data into ASCII string (a subset of UTF-8)

Silverstripe <= 4.4 does not have a binary db field implementation, so we have to store binary data as text

Parameters

string $data

This is a binary blob

Return Value

string

static string|null binaryDataJsonDecode(string $text)

Decode ASCII string into original binary data (a php string)

Silverstripe <= 4.4 does not have a binary db field implementation, so we have to store binary data as text

Parameters

string $text

Return Value

string|null