You are here

protected function CleanerCacheController::cleanerGetCacheTables in Cleaner 8

Helper function for gathering all names of cache tables in DB.

Return value

array List of all cache tables names.

1 call to CleanerCacheController::cleanerGetCacheTables()
CleanerCacheController::clearTables in src/Controller/CleanerCacheController.php
Clear cache tables.

File

src/Controller/CleanerCacheController.php, line 127

Class

CleanerCacheController
Class CleanerCacheController.

Namespace

Drupal\cleaner\Controller

Code

protected function cleanerGetCacheTables() {
  $tables = [];
  $database_name = $this
    ->getDatabaseName();
  if (!empty($database_name)) {
    $query = $this->connection
      ->select('INFORMATION_SCHEMA.TABLES', 'tables')
      ->fields('tables', [
      'table_name',
      'table_schema',
    ])
      ->condition('table_schema', $database_name)
      ->condition('table_name', 'cache_%', 'LIKE')
      ->condition('table_name', 'cachetags', '<>');
    $tables = $query
      ->execute()
      ->fetchCol();
  }
  return array_merge((array) $tables, (array) $this
    ->getAdditionalTables());
}