You are here

function database_sanitize_analyze in Database Sanitize 7

Same name and namespace in other branches
  1. 8 drush/database_sanitize.drush8.inc \database_sanitize_analyze()

Command callback for db-sanitize-analyze.

1 string reference to 'database_sanitize_analyze'
database_sanitize_drush_command in drush/database_sanitize.drush8.inc
Implements hook_drush_command().

File

drush/database_sanitize.drush8.inc, line 80
Drush Database Sanitize commands.

Code

function database_sanitize_analyze() {
  $yml_file_path = drush_get_option('file');
  if ($yml_file_path && !file_exists($yml_file_path)) {
    return drush_set_error(dt('File does not exist @file', [
      '@file' => $yml_file_path,
    ]));
  }
  require __DIR__ . '/../inc/database_sanitize.inc';
  $missing_tables = database_sanitize_get_unspecified_tables($yml_file_path);
  if (!$missing_tables) {
    drush_log(dt('All database tables are already specified in sanitize YML files'), 'ok');
    return;
  }
  drush_log(dt('There are @count tables not defined on sanitize YML files', [
    '@count' => count($missing_tables),
  ]), 'warning');
  if (drush_get_option('list')) {
    drush_log(implode("\n", $missing_tables), 'warning');
  }
}