From d2a5790053524437b907f616a7dea4016d79ac70 Mon Sep 17 00:00:00 2001 From: Tobia De Koninck Date: Fri, 24 Aug 2018 16:25:48 +0200 Subject: Add an occ command to report updates Signed-off-by: Tobia De Koninck --- apps/updatenotification/lib/Command/Check.php | 62 +++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 apps/updatenotification/lib/Command/Check.php (limited to 'apps/updatenotification/lib/Command/Check.php') diff --git a/apps/updatenotification/lib/Command/Check.php b/apps/updatenotification/lib/Command/Check.php new file mode 100644 index 00000000000..bca89adaa54 --- /dev/null +++ b/apps/updatenotification/lib/Command/Check.php @@ -0,0 +1,62 @@ +installer = $installer; + $this->appManager = $appManager; + $this->updateChecker = $updateChecker; + } + + protected function configure() { + $this + ->setName('update:check') + ->setDescription('Check for server and app updates') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) { + // Server + $r = $this->updateChecker->getUpdateState(); + if ($r['updateAvailable']) { + $output->writeln($r['updateVersion'] . ' is available. Get more information on how to update at '. $r['updateLink'] . '.'); + } + + + // Apps + $apps = $this->appManager->getInstalledApps(); + foreach ($apps as $app) { + $update = $this->installer->isUpdateAvailable($app); + if ($update !== false) { + $output->writeln('Update for ' . $app . ' to version ' . $update . ' is available.'); + } + } + + return 0; + } +} -- cgit v1.2.3