You are here

function webform_drush_sql_sync_sanitize in Webform 7.4

Same name and namespace in other branches
  1. 8.5 drush/webform.drush.hooks.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().

File

./webform.drush.inc, line 210
Functions relating to Drush integration.

Code

function webform_drush_sql_sync_sanitize($source) {

  // Fetch list of all table.
  $all_tables = drush_sql_get_class()
    ->listTables();
  $tables_to_truncate = array(
    'webform_submitted_data',
    'webform_submissions',
  );
  $truncate_webform_tables_query = array();
  foreach ($tables_to_truncate as $table) {
    if (in_array($table, $all_tables, TRUE)) {
      $truncate_webform_tables_query[] = 'TRUNCATE ' . $table . ';';
    }
  }
  drush_sql_register_post_sync_op('webform_submitted_data', dt('Delete all data submitted to webforms (depending on the site config, may contain sensitive data).'), implode(' ', $truncate_webform_tables_query));
}