function SessionHandler::ensureTableExists
Same name in other branches
- 11.x core/lib/Drupal/Core/Session/SessionHandler.php \Drupal\Core\Session\SessionHandler::ensureTableExists()
Check if the session table exists and create it if not.
Return value
bool TRUE if the table already exists or was created, FALSE if creation fails.
1 call to SessionHandler::ensureTableExists()
- SessionHandler::write in core/
lib/ Drupal/ Core/ Session/ SessionHandler.php
File
-
core/
lib/ Drupal/ Core/ Session/ SessionHandler.php, line 225
Class
- SessionHandler
- Default session handler.
Namespace
Drupal\Core\SessionCode
protected function ensureTableExists() : bool {
try {
$database_schema = $this->connection
->schema();
$schema_definition = $this->schemaDefinition();
$database_schema->createTable('sessions', $schema_definition);
} catch (DatabaseException $e) {
} catch (\Exception $e) {
return FALSE;
}
return TRUE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.