From b556ba3efa042225f5c5cb1d9aa50e0a52eb84c5 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Thu, 5 Feb 2026 12:07:30 +0100 Subject: [PATCH] feat(occ): show current version with occ app:update command Signed-off-by: Maksim Sukharev --- core/Command/App/Update.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php index 71c7f84e5b091..62e22e5465de3 100644 --- a/core/Command/App/Update.php +++ b/core/Command/App/Update.php @@ -48,6 +48,12 @@ protected function configure(): void { InputOption::VALUE_NONE, 'show update(s) without updating' ) + ->addOption( + 'showcurrent', + null, + InputOption::VALUE_NONE, + 'show currently installed version' + ) ->addOption( 'allow-unstable', null, @@ -60,6 +66,7 @@ protected function configure(): void { protected function execute(InputInterface $input, OutputInterface $output): int { $singleAppId = $input->getArgument('app-id'); $updateFound = false; + $showOnly = $input->getOption('showonly') || $input->getOption('showcurrent'); if ($singleAppId) { $apps = [$singleAppId]; @@ -69,7 +76,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln($singleAppId . ' not installed'); return 1; } - } elseif ($input->getOption('all') || $input->getOption('showonly')) { + } elseif ($input->getOption('all') || $showOnly) { $apps = $this->manager->getAllAppsInAppsFolders(); } else { $output->writeln('Please specify an app to update or "--all" to update all updatable apps"'); @@ -81,9 +88,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int $newVersion = $this->installer->isUpdateAvailable($appId, $input->getOption('allow-unstable')); if ($newVersion) { $updateFound = true; - $output->writeln($appId . ' new version available: ' . $newVersion); + $message = $appId . ' new version available: ' . $newVersion; + if ($input->getOption('showcurrent')) { + $message .= ' (current version: ' . $this->manager->getAppVersion($appId) . ')'; + } + $output->writeln($message); - if (!$input->getOption('showonly')) { + if (!$showOnly) { try { $result = $this->installer->updateAppstoreApp($appId, $input->getOption('allow-unstable')); } catch (\Exception $e) {