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\Command
Code
protected function execute(InputInterface $input, OutputInterface $output) {
$io = new DrupalStyle($input, $output);
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));
}
$from_active = $input
->getOption('from-active');
$successful = $this->generator
->generate($module, $update_number, $include_modules, $from_active);
$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;
}