function SessionManager::save
Same name in other branches
- 9 core/lib/Drupal/Core/Session/SessionManager.php \Drupal\Core\Session\SessionManager::save()
- 8.9.x core/lib/Drupal/Core/Session/SessionManager.php \Drupal\Core\Session\SessionManager::save()
- 10 core/lib/Drupal/Core/Session/SessionManager.php \Drupal\Core\Session\SessionManager::save()
File
-
core/
lib/ Drupal/ Core/ Session/ SessionManager.php, line 142
Class
- SessionManager
- Manages user sessions.
Namespace
Drupal\Core\SessionCode
public function save() : void {
if ($this->isCli()) {
// We don't have anything to do if we are not allowed to save the session.
return;
}
if ($this->isSessionObsolete()) {
// There is no session data to store, destroy the session if it was
// previously started.
if ($this->getSaveHandler()
->isActive()) {
$this->destroy();
}
}
else {
// There is session data to store. Start the session if it is not already
// started.
if (!$this->getSaveHandler()
->isActive()) {
$this->startNow();
}
// Write the session data.
parent::save();
}
$this->startedLazy = FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.