You are here

protected function GdprSqlDump::cleanup in General Data Protection Regulation 8.2

Same name and namespace in other branches
  1. 8 modules/gdpr_dump/src/Service/GdprSqlDump.php \Drupal\gdpr_dump\Service\GdprSqlDump::cleanup()
  2. 3.0.x modules/gdpr_dump/src/Service/GdprSqlDump.php \Drupal\gdpr_dump\Service\GdprSqlDump::cleanup()

Cleanup the database after the dump.

Throws

\Drupal\Core\Database\TransactionNoActiveException

\Drupal\Core\Database\TransactionCommitFailedException

2 calls to GdprSqlDump::cleanup()
GdprSqlDump::dump in modules/gdpr_dump/src/Service/GdprSqlDump.php
Dump command.
GdprSqlDump::prepare in modules/gdpr_dump/src/Service/GdprSqlDump.php
Prepare the database for the dump.

File

modules/gdpr_dump/src/Service/GdprSqlDump.php, line 337

Class

GdprSqlDump
Class GdprSqlDump.

Namespace

Drupal\gdpr_dump\Service

Code

protected function cleanup() {
  $transaction = $this->database
    ->startTransaction('gdpr_drop_table');
  foreach (array_keys($this->tablesToAnonymize) as $table) {
    $gdprTable = self::GDPR_TABLE_PREFIX . $table;
    $this->database
      ->schema()
      ->dropTable($gdprTable);
  }
  $this->database
    ->popTransaction($transaction
    ->name());
}