class MongodbSessionManager in MongoDB 8
Hierarchy
- class \Drupal\Core\Session\SessionManager extends \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage implements SessionManagerInterface uses DependencySerializationTrait
- class \Drupal\mongodb_user\MongodbSessionManager
Expanded class hierarchy of MongodbSessionManager
1 string reference to 'MongodbSessionManager'
- mongodb_user.services.yml in mongodb_user/
mongodb_user.services.yml - mongodb_user/mongodb_user.services.yml
1 service uses MongodbSessionManager
File
- mongodb_user/
src/ MongodbSessionManager.php, line 18 - Contains \Drupal\mongodb_user\MongodbSessionManager.
Namespace
Drupal\mongodb_userView source
class MongodbSessionManager extends BaseSessionManager {
/**
* @var MongoCollectionFactory
*/
protected $mongo;
public function __construct(RequestStack $request_stack, MongoCollectionFactory $mongo, MetadataBag $metadata_bag, SessionConfigurationInterface $session_configuration, $handler = NULL) {
BaseSessionManager::__construct($request_stack, new FakeConnection([]), $metadata_bag, $session_configuration, $handler);
$this->mongo = $mongo;
}
public function delete($uid) {
// Nothing to do if we are not allowed to change the session.
if (!$this->writeSafeHandler
->isSessionWritable() || $this
->isCli()) {
return;
}
$this->mongo
->get('sessions')
->remove(array(
'uid' => (int) $uid,
));
}
protected function migrateStoredSession($old_session_id) {
$criteria = [
'sid' => Crypt::hashBase64($old_session_id),
];
$newobj = array(
'sid' => Crypt::hashBase64($this
->getId()),
);
$this->mongo
->get('sessions')
->update($criteria, $newobj);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
MongodbSessionManager:: |
protected | property | ||
MongodbSessionManager:: |
public | function |
Ends a specific user's session(s). Overrides SessionManager:: |
|
MongodbSessionManager:: |
protected | function |
Migrates the current session to a new session id. Overrides SessionManager:: |
|
MongodbSessionManager:: |
public | function |
Constructs a new session manager instance. Overrides SessionManager:: |
|
SessionManager:: |
protected | property | The database connection to use. | |
SessionManager:: |
protected | property | The request stack. | |
SessionManager:: |
protected | property | The session configuration. | |
SessionManager:: |
protected | property | Whether a lazy session has been started. | |
SessionManager:: |
protected | property | The write safe session handler. | |
SessionManager:: |
public | function |
Destroys the current session and removes session cookies. Overrides SessionManagerInterface:: |
|
SessionManager:: |
protected | function | Returns a map specifying which session key is containing user data. | |
SessionManager:: |
protected | function | Returns whether the current PHP process runs on CLI. | |
SessionManager:: |
protected | function | Determines whether the session contains user data. | |
SessionManager:: |
public | function | Regenerates id that represents this storage. | |
SessionManager:: |
public | function | Force the session to be saved and closed. | |
SessionManager:: |
public | function |
Sets the write safe session handler. Overrides SessionManagerInterface:: |
|
SessionManager:: |
public | function | Starts the session. | |
SessionManager:: |
protected | function | Forcibly start a PHP session. |