DbImportCommand::execute

protected DbImportCommand::execute(InputInterface $input, OutputInterface $output)

Executes the current command.

This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.

Parameters

InputInterface $input An InputInterface instance:

OutputInterface $output An OutputInterface instance:

Return value

null|int null or 0 if everything went fine, or an error code

Throws

LogicException When this abstract method is not implemented

Overrides Command::execute

See also

setCode()

File

core/lib/Drupal/Core/Command/DbImportCommand.php, line 35

Class

DbImportCommand
Provides a command to import the current database from a script.

Namespace

Drupal\Core\Command

Code

protected function execute(InputInterface $input, OutputInterface $output) {
  $script = $input->getArgument('script');
  if (!is_file($script)) {
    $output->writeln('File must exist.');
    return;
  }

  $connection = $this->getDatabaseConnection($input);
  $this->runScript($connection, $script);
  $output->writeln('Import completed successfully.');
}
doc_Drupal
2016-10-29 09:01:10
Comments
Leave a Comment

Please login to continue.