Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DbDumpCommand.php

function DbDumpCommand::execute

Overrides Command::execute

File

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

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) : int {
    $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);
    $insert_count = (int) $input->getOption('insert-count');
    $output->writeln($this->generateScript($connection, $schema_tables, $insert_count), OutputInterface::OUTPUT_RAW);
    return 0;
}
RSS feed
Powered by Drupal