SessionManager
class SessionManager extends NativeSessionStorage implements SessionManagerInterface (View source)
Manages user sessions.
This class implements the custom session management code inherited from Drupal 7 on top of the corresponding Symfony component. Regrettably the name NativeSessionStorage is not quite accurate. In fact the responsibility for storing and retrieving session data has been extracted from it in Symfony 2.1 but the class name was not changed.
Traits
Provides dependency injection friendly methods for serialization.
Properties
| protected array | $_serviceIds | An array of service IDs keyed by property name used for serialization. |
from DependencySerializationTrait |
| protected array | $_entityStorages | An array of entity type IDs keyed by the property name of their storages. |
from DependencySerializationTrait |
| protected RequestStack | $requestStack | The request stack. |
|
| protected Connection | $connection | The database connection to use. |
|
| protected SessionConfigurationInterface | $sessionConfiguration | The session configuration. |
|
| protected bool | $startedLazy | Whether a lazy session has been started. |
|
| protected WriteSafeSessionHandlerInterface | $writeSafeHandler | The write safe session handler. |
Methods
Constructs a new session manager instance.
{@inheritdoc}
{@inheritdoc}
Forcibly start a PHP session.
{@inheritdoc}
{@inheritdoc}
Ends a specific user's session(s).
Destroys the current session and removes session cookies.
Returns whether the current PHP process runs on CLI.
Determines whether the session contains user data.
Returns a map specifying which session key is containing user data.
Details
__sleep()
{@inheritdoc}
__wakeup()
{@inheritdoc}
__construct(RequestStack $request_stack, Connection $connection, MetadataBag $metadata_bag, SessionConfigurationInterface $session_configuration, AbstractProxy|NativeSessionHandler|SessionHandlerInterface|null $handler = NULL)
Constructs a new session manager instance.
start()
{@inheritdoc}
getId()
{@inheritdoc}
protected bool
startNow()
Forcibly start a PHP session.
save()
{@inheritdoc}
regenerate($destroy = FALSE, $lifetime = NULL)
{@inheritdoc}
delete(int $uid)
Ends a specific user's session(s).
destroy()
Destroys the current session and removes session cookies.
setWriteSafeHandler(WriteSafeSessionHandlerInterface $handler)
Sets the write safe session handler.
protected bool
isCli()
Returns whether the current PHP process runs on CLI.
Command line clients do not support cookies nor sessions.
protected bool
isSessionObsolete()
Determines whether the session contains user data.
protected array
getSessionDataMask()
Returns a map specifying which session key is containing user data.