protected function GdprDumpGdprSqlDump::createTableClones in General Data Protection Regulation 7
Creates table clones according to the config.
1 call to GdprDumpGdprSqlDump::createTableClones()
- GdprDumpGdprSqlDump::prepare in modules/
gdpr_dump/ inc/ GdprDumpGdprSqlDump.inc - Prepare the database for the dump.
File
- modules/
gdpr_dump/ inc/ GdprDumpGdprSqlDump.inc, line 153
Class
- GdprDumpGdprSqlDump
- Class GdprDumpGdprSqlDump.
Code
protected function createTableClones() {
$tables = \array_keys($this->gdprOptions);
$transaction = db_transaction('gdpr_drop_table');
try {
foreach ($tables as $table) {
$queryString = $this
->createCloneQueryString($table);
if (NULL === $queryString) {
// @todo: Notify?
continue;
}
try {
if (drush_get_context('DRUSH_VERBOSE') || drush_get_context('DRUSH_SIMULATE')) {
drush_print("Executing: '{$queryString}'", 0, STDERR);
}
db_query($queryString);
} catch (\Exception $e) {
drush_print("Error while cloning the '{$table}' table.");
$transaction
->rollBack();
}
}
} catch (Exception $e) {
$transaction
->rollBack();
drush_set_error('DRUSH_SQL_DUMP_FAIL', 'Table clone failed');
}
}