Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SessionHandler.php

function 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 209

Class

SessionHandler
Default session handler.

Namespace

Drupal\Core\Session

Code

protected function ensureTableExists() : bool {
    try {
        $database_schema = $this->connection
            ->schema();
        $schema_definition = $this->schemaDefinition();
        $database_schema->createTable('sessions', $schema_definition);
    } catch (DatabaseException) {
    } catch (\Exception) {
        return FALSE;
    }
    return TRUE;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal