function DbDumpCommand::execute

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Command/DbDumpCommand.php \Drupal\Core\Command\DbDumpCommand::execute()
  2. 10 core/lib/Drupal/Core/Command/DbDumpCommand.php \Drupal\Core\Command\DbDumpCommand::execute()
  3. 8.9.x core/lib/Drupal/Core/Command/DbDumpCommand.php \Drupal\Core\Command\DbDumpCommand::execute()

File

core/lib/Drupal/Core/Command/DbDumpCommand.php, line 51

Class

DbDumpCommand
Provides a command to dump the current database to a script.

Namespace

Drupal\Core\Command

Code

protected function execute(InputInterface $input, OutputInterface $output) {
  $connection = $this->getDatabaseConnection($input);
  // If not explicitly set, disable ANSI which will break generated php.
  if ($input->hasParameterOption([
    '--ansi',
  ]) !== TRUE) {
    $output->setDecorated(FALSE);
  }
  $schema_tables = $input->getOption('schema-only');
  $schema_tables = explode(',', $schema_tables);
  $output->writeln($this->generateScript($connection, $schema_tables), OutputInterface::OUTPUT_RAW);
  return 0;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.