You are here

public function GdprDumpCommands::dump in General Data Protection Regulation 8.2

Same name and namespace in other branches
  1. 3.0.x modules/gdpr_dump/src/Commands/GdprDumpCommands.php \Drupal\gdpr_dump\Commands\GdprDumpCommands::dump()

Exports the Drupal DB as SQL using mysqldump or equivalent.

@command gdpr:sql:dump @aliases gdpr-sql-dump @optionset_sql @optionset_table_selection @option result-file Save to a file. The file should be relative to Drupal root. @option create-db Omit DROP TABLE statements. Used by Postgres and Oracle only. @option data-only Dump data without statements to create any of the schema. @option ordered-dump Order by primary key and add line breaks for efficient diffs. Slows down the dump. Mysql only. @option gzip Compress the dump using the gzip program which must be in your $PATH. @option extra Add custom arguments/options when connecting to database (used internally to list tables). @option extra-dump Add custom arguments/options to the dumping the database (e.g. mysqldump command). @usage drush gdpr:sql:dump --result-file=../18.sql Save SQL dump to the directory above Drupal root. @usage drush gdpr:sql:dump --skip-tables-key=common Skip standard tables. @usage drush gdpr:sql:dump --extra-dump=--no-data Pass extra option to mysqldump command. @hidden-options create-db @bootstrap max configuration

@notes The createdb command is used by sql-sync, since including the DROP TABLE statements interfere with the import when the database is created.

Parameters

array $options: The options for the command.

Return value

bool|\Drupal\gdpr_dump\Sql\GdprSqlBase The result of the dump.

Throws

\Exception

See also

example.drush.yml

\Drush\Commands\sql\SqlCommands::dump()

File

modules/gdpr_dump/src/Commands/GdprDumpCommands.php, line 98

Class

GdprDumpCommands
Class GdprDumpCommands.

Namespace

Drupal\gdpr_dump\Commands

Code

public function dump(array $options = self::DEFAULT_DUMP_OPTIONS) {
  try {
    return $this->dumpService
      ->dump($options);
  } catch (Exception $e) {
    return drush_set_error('DRUSH_DUMP_ERROR', $e
      ->getMessage());
  }
}