58 if ($this->storage->getId()) {
62 $result = $this->storage->start();
74 public function migrate($destroy =
false) {
75 return $this->storage->migrate($destroy);
87 $this->storage->clear();
88 $this->logged_in_user = null;
102 $this->storage->save();
112 return $this->storage->isStarted();
122 return $this->storage->getId();
133 $this->storage->setId(
$id);
143 return $this->storage->getName();
154 $this->storage->setName(
$name);
165 return $this->storage->get(
$name, $default);
187 return $this->storage->remove(
$name);
198 return $this->storage->has(
$name);
210 if ($current_user != $user) {
211 $this->
set(
'guid', $user->guid);
212 $this->logged_in_user =
$user;
214 _elgg_services()->translator->setCurrentLanguage($user->language);
266 $this->logged_in_user = null;
267 $this->
remove(
'guid');
289 $this->ignore_access = $ignore;
301 if (isset($ENTITY_SHOW_HIDDEN_OVERRIDE)) {
317 $ENTITY_SHOW_HIDDEN_OVERRIDE = $show;
320 $this->show_disabled_entities = $show;
335 if (!$this->
has(
'__elgg_session')) {
336 $this->
set(
'__elgg_session',
_elgg_services()->crypto->getRandomString(22));
348 $storage =
new MockArraySessionStorage();
350 return new self($session);
368 'cache_limiter' => session_cache_limiter(),
371 'cookie_path' =>
$params[
'path'],
372 'cookie_domain' =>
$params[
'domain'],
373 'cookie_secure' =>
$params[
'secure'],
374 'cookie_httponly' =>
$params[
'httponly'],
375 'cookie_lifetime' =>
$params[
'lifetime'],
381 return new self($session);
398 'cache_limiter' => session_cache_limiter(),
401 'cookie_path' =>
$params[
'path'],
402 'cookie_domain' =>
$params[
'domain'],
403 'cookie_secure' =>
$params[
'secure'],
404 'cookie_httponly' =>
$params[
'httponly'],
405 'cookie_lifetime' =>
$params[
'lifetime'],
410 return new self($session);
setId($id)
Set the session ID.
setName($name)
Set the session name.
setLoggedInUser(\ElggUser $user)
Sets the logged in user.
has($name)
Has the attribute been defined.
save()
Save the session data and closes the session.
if(!$user||!$user->canDelete()) $name
$params
Saves global plugin settings.
setDisabledEntityVisibility($show=true)
Include disabled entities in queries.
generateSessionToken()
Adds a token to the session.
migrate($destroy=false)
Migrates the session to a new session id while maintaining session attributes.
getName()
Get the session name.
isLoggedIn()
Returns whether or not the user is currently logged in.
removeLoggedInUser()
Remove the logged in user.
invalidate()
Invalidates the session.
static fromFiles(Config $config)
Create a session stored in files.
getDisabledEntityVisibility()
Are disabled entities shown?
isStarted()
Has the session been started.
getId()
Get the session ID.
start()
Start the session.
getLoggedInUserGuid()
Return the current logged in user by guid.
$config
Advanced site settings, debugging section.
getIgnoreAccess()
Get current ignore access setting.
$id
River item delete action.
global $ENTITY_SHOW_HIDDEN_OVERRIDE
Allow disabled entities and metadata to be returned by getter functions.
getLoggedInUser()
Gets the logged in user.
isAdminLoggedIn()
Returns whether or not the viewer is currently logged in and an admin user.
elgg global
Pointer to the global context.
__construct(SessionInterface $storage)
Constructor.
getCookieConfig()
Set up and return the cookie configuration array resolved from settings.
Database session handler.
setIgnoreAccess($ignore=true)
Set ignore access.
_elgg_services()
Get the global service provider.
static getMock()
Get an isolated ElggSession that does not persist between requests.
static fromDatabase(Config $config, Database $db)
Create a session stored in the DB.