You are here

public function AcsfDuplicationScrubTruncateTablesHandler::truncateTables in Acquia Cloud Site Factory Connector 8.2

Same name and namespace in other branches
  1. 8 src/Event/AcsfDuplicationScrubTruncateTablesHandler.php \Drupal\acsf\Event\AcsfDuplicationScrubTruncateTablesHandler::truncateTables()

Truncates database tables.

Parameters

array $tables: The list of tables to be truncated.

1 call to AcsfDuplicationScrubTruncateTablesHandler::truncateTables()
AcsfDuplicationScrubTruncateTablesHandler::handle in src/Event/AcsfDuplicationScrubTruncateTablesHandler.php
Implements AcsfEventHandler::handle().

File

src/Event/AcsfDuplicationScrubTruncateTablesHandler.php, line 56

Class

AcsfDuplicationScrubTruncateTablesHandler
Truncates various undesirable Drupal core tables.

Namespace

Drupal\acsf\Event

Code

public function truncateTables(array $tables = []) {
  $connection = \Drupal::database();
  foreach ($tables as $table) {
    if ($connection
      ->schema()
      ->tableExists($table)) {
      $connection
        ->truncate($table)
        ->execute();
    }
  }
}