You are here

protected function CleanerCacheClearEventSubscriber::cleanerGetCacheTables in Cleaner 8.2

Get cache tables list.

Return value

array Cache tables list array.

1 call to CleanerCacheClearEventSubscriber::cleanerGetCacheTables()
CleanerCacheClearEventSubscriber::clearCaches in src/EventSubscriber/CleanerCacheClearEventSubscriber.php
Cleaner caches clearing.

File

src/EventSubscriber/CleanerCacheClearEventSubscriber.php, line 138

Class

CleanerCacheClearEventSubscriber
Class CleanerCacheClearEventSubscriber.

Namespace

Drupal\cleaner\EventSubscriber

Code

protected function cleanerGetCacheTables() {
  $tables = [];
  $db_name = $this
    ->getDatabaseName();
  if (!empty($db_name)) {
    $query = $this->database
      ->select('INFORMATION_SCHEMA.TABLES', 'tables');
    $query
      ->fields('tables', [
      'table_name',
      'table_schema',
    ]);
    $query
      ->condition('table_schema', $db_name);
    $query
      ->condition('table_name', 'cache_%', 'LIKE');

    // Exclude cachetags table.
    $query
      ->condition('table_name', 'cachetags', '<>');
    $tables = $query
      ->execute()
      ->fetchCol();
  }
  return $tables;
}