You are here

protected function RunUpdatesCommand::execute in Scheduled Updates 8

File

src/Command/RunUpdatesCommand.php, line 36
Contains \Drupal\scheduled_updates\Command\RunUpdatesCommand.

Class

RunUpdatesCommand
Class RunUpdatesCommand.

Namespace

Drupal\scheduled_updates\Command

Code

protected function execute(InputInterface $input, OutputInterface $output) {
  $io = new DrupalStyle($input, $output);

  /** @var UpdateRunnerUtils $runnerUtils */
  if ($runnerUtils = $this
    ->hasGetService('scheduled_updates.update_runner')) {
    $update_types = $input
      ->getArgument('update_types');
    if ($update_types) {
      $update_types = explode(',', $update_types);
    }
    else {
      $update_types = [];
    }
    $this->runnerUtils
      ->runAllUpdates($update_types, true);
    $io
      ->info('Updates run!');
  }
  else {
    $io
      ->error('Could not get Global Runner service. No updates run.');
  }
}