You are here

public function BackupDatabaseClient::dump in Backup Database 8

Perform the database dump.

Return value

Mysqldump

Overrides BackupDatabaseClientInterface::dump

File

src/BackupDatabaseClient.php, line 66
Contains \Drupal\backup_db\BackupDatabaseClient

Class

BackupDatabaseClient
BackupDatabaseClient class.

Namespace

Drupal\backup_db

Code

public function dump() {

  // Get configuration for export.
  $config = $this
    ->getSettings();
  $options = $this
    ->getConnectionOptions();

  // Return export to the adapter.
  return new IMysqldump\Mysqldump($options['connection'], $options['username'], $options['password'], [
    'include-tables' => $config
      ->get('settings.include_tables'),
    'exclude-tables' => $config
      ->get('settings.exclude_tables'),
    'compress' => $config
      ->get('settings.compress'),
    'no-data' => $config
      ->get('settings.no_data'),
    'add-drop-table' => $config
      ->get('settings.add_drop_table'),
    'single-transaction' => $config
      ->get('settings.single_transaction'),
    'lock-tables' => $config
      ->get('settings.lock_tables'),
    'add-locks' => $config
      ->get('settings.add_locks'),
    'extended-insert' => $config
      ->get('settings.extended_insert'),
    'complete-insert' => $config
      ->get('settings.complete_insert'),
    'disable-keys' => $config
      ->get('settings.disable_keys'),
    'where' => $config
      ->get('settings.where'),
    'no-create-info' => $config
      ->get('settings.no_create_info'),
    'skip-triggers' => $config
      ->get('settings.skip_triggers'),
    'add-drop-trigger' => $config
      ->get('settings.add_drop_trigger'),
    'routines' => $config
      ->get('settings.routines'),
    'hex-blob' => $config
      ->get('settings.hex_blob'),
    'databases' => $config
      ->get('settings.databases'),
    'add-drop-database' => $config
      ->get('settings.add_drop_database'),
    'skip-tz-utc' => $config
      ->get('settings.skip_tz_utc'),
    'no-autocommit' => $config
      ->get('settings.no_autocommit'),
    'default-character-set' => $config
      ->get('settings.default_character_set'),
    'skip-comments' => $config
      ->get('settings.skip_comments'),
    'skip-dump-date' => $config
      ->get('settings.skip_dump_date'),
  ]);
}