protected function GenerateConfigurationUpdateCommand::execute in Update helper 8
File
- src/
Command/ GenerateConfigurationUpdateCommand.php, line 139
Class
- GenerateConfigurationUpdateCommand
- Generate configuration update command class.
Namespace
Drupal\update_helper\CommandCode
protected function execute(InputInterface $input, OutputInterface $output) {
$io = new DrupalStyle($input, $output);
// @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmOperation
if (!$this
->confirmOperation()) {
return 1;
}
$module = $input
->getOption('module');
$include_modules = $input
->getOption('include-modules');
$update_number = $input
->getOption('update-n');
$last_update_number = $this
->getLastUpdate($module);
if ($update_number <= $last_update_number) {
throw new \InvalidArgumentException(sprintf($this
->trans('commands.generate.configuration.update.messages.wrong-update-n'), $update_number));
}
// Flag if export should be from active config to Yml files.
$from_active = $input
->getOption('from-active');
// Execute configuration update generation.
$successful = $this->generator
->generate($module, $update_number, $include_modules, $from_active);
// Get additional options provided by other modules.
$event = new CommandExecuteEvent($this, $module, $update_number, $input
->getOptions(), $successful);
$this->eventDispatcher
->dispatch(UpdateHelperEvents::COMMAND_GCU_EXECUTE, $event);
if ($successful) {
$io
->info($this
->trans('commands.generate.configuration.update.messages.success'));
}
else {
$io
->info($this
->trans('commands.generate.configuration.update.messages.no-update'));
}
return 0;
}