|
| 1 | +From ac6653ec5b9746c6695fc46dcee81379af048220 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Arthur Schiwon <blizzz@arthur-schiwon.de> |
| 3 | +Date: Fri, 12 Sep 2025 11:48:28 +0200 |
| 4 | +Subject: [PATCH] fix(Apps): fix install command check on existing apps |
| 5 | + |
| 6 | +- AppManager::isInstalled() is misleading, as it checks only whether it is |
| 7 | + enabled. But an app might not be present in some edge cases. |
| 8 | +- AppManager::getAppPath() does however only check whether an app dir is |
| 9 | + present, independent of the enabled-state. |
| 10 | + |
| 11 | +Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de> |
| 12 | +--- |
| 13 | + core/Command/App/Install.php | 5 ++++- |
| 14 | + 1 file changed, 4 insertions(+), 1 deletion(-) |
| 15 | + |
| 16 | +diff --git a/core/Command/App/Install.php b/core/Command/App/Install.php |
| 17 | +index aa263a8f3bfc9..f7fa92208eaaa 100644 |
| 18 | +--- a/core/Command/App/Install.php |
| 19 | ++++ b/core/Command/App/Install.php |
| 20 | +@@ -9,6 +9,7 @@ |
| 21 | + namespace OC\Core\Command\App; |
| 22 | + |
| 23 | + use OC\Installer; |
| 24 | ++use OCP\App\AppPathNotFoundException; |
| 25 | + use OCP\App\IAppManager; |
| 26 | + use Symfony\Component\Console\Command\Command; |
| 27 | + use Symfony\Component\Console\Input\InputArgument; |
| 28 | +@@ -58,9 +59,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int |
| 29 | + $appId = $input->getArgument('app-id'); |
| 30 | + $forceEnable = (bool) $input->getOption('force'); |
| 31 | + |
| 32 | +- if ($this->appManager->isInstalled($appId)) { |
| 33 | ++ try { |
| 34 | ++ $this->appManager->getAppPath($appId); |
| 35 | + $output->writeln($appId . ' already installed'); |
| 36 | + return 1; |
| 37 | ++ } catch (AppPathNotFoundException) { |
| 38 | + } |
| 39 | + |
| 40 | + try { |
0 commit comments