You are here

protected function DatabaseUpdate::execute in Automatic Updates 8

Overrides BaseCommand::execute

File

src/Command/DatabaseUpdate.php, line 26

Class

DatabaseUpdate
Database update command.

Namespace

Drupal\automatic_updates\Command

Code

protected function execute(InputInterface $input, OutputInterface $output) {
  parent::execute($input, $output);
  $pending_updates = \Drupal::service('automatic_updates.pending_db_updates')
    ->run();
  if ($pending_updates) {
    $output
      ->writeln('Started database updates.');
    $this
      ->executeDatabaseUpdates();
    $output
      ->writeln('Finished database updates.');
  }
  else {
    $output
      ->writeln('No database updates required.');
  }
  return 0;
}