Add summary with amount of updates
Signed-off-by: Tobia De Koninck <LEDfan@users.noreply.github.com>
This commit is contained in:
parent
e87caedf7e
commit
d492b2c399
|
@ -62,10 +62,13 @@ class Check extends Command {
|
|||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
||||
$updatesAvailableCount = 0;
|
||||
|
||||
// Server
|
||||
$r = $this->updateChecker->getUpdateState();
|
||||
if (isset($r['updateAvailable']) && $r['updateAvailable']) {
|
||||
$output->writeln($r['updateVersion'] . ' is available. Get more information on how to update at '. $r['updateLink'] . '.');
|
||||
$updatesAvailableCount += 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,9 +78,19 @@ class Check extends Command {
|
|||
$update = $this->installer->isUpdateAvailable($app);
|
||||
if ($update !== false) {
|
||||
$output->writeln('Update for ' . $app . ' to version ' . $update . ' is available.');
|
||||
$updatesAvailableCount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Report summary
|
||||
if ($updatesAvailableCount === 0) {
|
||||
$output->writeln('<info>Everything up to date</info>');
|
||||
} else if ($updatesAvailableCount === 1) {
|
||||
$output->writeln('<comment>1 update available</comment>');
|
||||
} else {
|
||||
$output->writeln('<comment>' . $updatesAvailableCount . ' updates available</comment>');
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue