Elgg
Version master
|
Elgg Session Management. More...
Public Member Functions | |
__construct (SessionInterface $storage) | |
Constructor. More... | |
boot () | |
Initializes the session and checks for the remember me cookie. More... | |
start () | |
Start the session. More... | |
migrate (bool $destroy=true) | |
Migrates the session to a new session id while maintaining session attributes. More... | |
invalidate () | |
Invalidates the session. More... | |
save () | |
Save the session data and closes the session. More... | |
isStarted () | |
Has the session been started. More... | |
getID () | |
Get the session ID. More... | |
setId ($id) | |
Set the session ID. More... | |
getName () | |
Get the session name. More... | |
setName ($name) | |
Set the session name. More... | |
get ($name, $default=null) | |
Get an attribute of the session. More... | |
set ($name, $value) | |
Set an attribute. More... | |
remove ($name) | |
Remove an attribute. More... | |
has ($name) | |
Has the attribute been defined. More... | |
Static Public Member Functions | |
static | getMock () |
Get an isolated ElggSession that does not persist between requests. More... | |
static | fromDatabase (Config $config, Database $db) |
Create a session stored in the DB. More... | |
static | fromFiles (Config $config) |
Create a session stored in files. More... | |
Protected Member Functions | |
generateSessionToken () | |
Adds a token to the session. More... | |
Protected Attributes | |
$storage | |
Elgg Session Management.
Reserved keys: last_forward_from, msg, sticky_forms, user, guid, id, code, name, username
Definition at line 19 of file ElggSession.php.
ElggSession::__construct | ( | SessionInterface | $storage | ) |
Constructor.
SessionInterface | $storage | The underlying Session implementation |
Definition at line 33 of file ElggSession.php.
ElggSession::boot | ( | ) |
Initializes the session and checks for the remember me cookie.
Definition at line 44 of file ElggSession.php.
Create a session stored in the DB.
Config | $config | Config |
Database | $db | Database |
Definition at line 273 of file ElggSession.php.
|
static |
Create a session stored in files.
Config | $config | Config |
Definition at line 304 of file ElggSession.php.
|
protected |
Adds a token to the session.
This is used in creation of CSRF token, and is passed to the client to allow validating tokens later, even if the PHP session was destroyed.
Definition at line 243 of file ElggSession.php.
ElggSession::get | ( | $name, | |
$default = null |
|||
) |
Get an attribute of the session.
string | $name | Name of the attribute to get |
mixed | $default | Value to return if attribute is not set (default is null) |
Definition at line 198 of file ElggSession.php.
ElggSession::getID | ( | ) |
|
static |
Get an isolated ElggSession that does not persist between requests.
Definition at line 257 of file ElggSession.php.
ElggSession::getName | ( | ) |
ElggSession::has | ( | $name | ) |
Has the attribute been defined.
string | $name | Name of the attribute |
Definition at line 231 of file ElggSession.php.
ElggSession::invalidate | ( | ) |
Invalidates the session.
Deletes session data and session persistence. Starts a new session.
Definition at line 121 of file ElggSession.php.
ElggSession::isStarted | ( | ) |
Has the session been started.
Definition at line 145 of file ElggSession.php.
ElggSession::migrate | ( | bool | $destroy = true | ) |
Migrates the session to a new session id while maintaining session attributes.
boolean | $destroy | Whether to delete the session or let gc handle clean up |
Definition at line 109 of file ElggSession.php.
ElggSession::remove | ( | $name | ) |
Remove an attribute.
string | $name | The name of the attribute to remove |
Definition at line 220 of file ElggSession.php.
ElggSession::save | ( | ) |
Save the session data and closes the session.
Definition at line 135 of file ElggSession.php.
ElggSession::set | ( | $name, | |
$value | |||
) |
Set an attribute.
string | $name | Name of the attribute to set |
mixed | $value | Value to be set |
Definition at line 209 of file ElggSession.php.
ElggSession::setId | ( | $id | ) |
Set the session ID.
string | $id | Session ID |
Definition at line 166 of file ElggSession.php.
ElggSession::setName | ( | $name | ) |
Set the session name.
string | $name | Session name |
Definition at line 187 of file ElggSession.php.
ElggSession::start | ( | ) |
Start the session.
RuntimeException | If session fails to start. |
Definition at line 91 of file ElggSession.php.
|
protected |
Definition at line 26 of file ElggSession.php.