You are here

protected function DatabaseCacheTagsChecksum::ensureTableExists in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php \Drupal\Core\Cache\DatabaseCacheTagsChecksum::ensureTableExists()

Check if the cache tags table exists and create it if not.

2 calls to DatabaseCacheTagsChecksum::ensureTableExists()
DatabaseCacheTagsChecksum::calculateChecksum in core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php
Calculates the current checksum for a given set of tags.
DatabaseCacheTagsChecksum::invalidateTags in core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php
Marks cache items with any of the specified tags as invalid.

File

core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php, line 149
Contains \Drupal\Core\Cache\DatabaseCacheTagsChecksum.

Class

DatabaseCacheTagsChecksum
Cache tags invalidations checksum implementation that uses the database.

Namespace

Drupal\Core\Cache

Code

protected function ensureTableExists() {
  try {
    $database_schema = $this->connection
      ->schema();

    // Create the cache tags table if it does not exist.
    if (!$database_schema
      ->tableExists('cachetags')) {
      $schema_definition = $this
        ->schemaDefinition();
      $database_schema
        ->createTable('cachetags', $schema_definition);
      return TRUE;
    }
  } catch (SchemaObjectExistsException $e) {
    return TRUE;
  }
  return FALSE;
}