You are here

function webform_drush_sql_sync_sanitize in Webform 8.5

Same name and namespace in other branches
  1. 7.4 webform.drush.inc \webform_drush_sql_sync_sanitize()
  2. 6.x drush/webform.drush.hooks.inc \webform_drush_sql_sync_sanitize()

Implements hook_drush_sql_sync_sanitize().

See also

sql_drush_sql_sync_sanitize()

\Drush\Commands\core\SanitizeCommands::sanitizeSessions

File

drush/webform.drush.hooks.inc, line 14
Drush 8 hooks.

Code

function webform_drush_sql_sync_sanitize($site) {
  $wrap_table_name = drush_get_option('db-prefix');
  $tables = array_intersect([
    'webform_submission',
    'webform_submission_data',
    'webform_submission_log',
  ], drush_sql_get_class()
    ->listTables());
  $query = [];
  foreach ($tables as $table) {
    if ($wrap_table_name) {
      $table = "{{$table}}";
    }
    $query[] = 'TRUNCATE ' . $table . ';';
  }
  drush_sql_register_post_sync_op('webform_submission', dt('Truncate webform submission tables.'), implode(' ', $query));
}