You are here

protected function CleanerCacheController::clearTables in Cleaner 8

Clear cache tables.

1 call to CleanerCacheController::clearTables()
CleanerCacheController::execute in src/Controller/CleanerCacheController.php
Perform the operation.

File

src/Controller/CleanerCacheController.php, line 55

Class

CleanerCacheController
Class CleanerCacheController.

Namespace

Drupal\cleaner\Controller

Code

protected function clearTables() {
  if (\Drupal::config(CLEANER_SETTINGS)
    ->get(self::$configName)) {
    $cleared = 0;
    $this->connection = \Drupal::database();

    // Prepare cache tables list.
    $tables = (array) $this
      ->cleanerGetCacheTables();

    // Ensure tables exists.
    if (!empty($tables)) {

      // Clear the tables and increments the cleared entries count.
      $cleared += (int) $this
        ->performClearing($tables);
    }

    // Log the operation.
    self::logResults($cleared);
  }
}