Skip to content

Commit 3c54091

Browse files
blizzzbackportbot[bot]
authored andcommitted
fix(Apps): fix install command check on existing apps
- AppManager::isInstalled() is misleading, as it checks only whether it is enabled. But an app might not be present in some edge cases. - AppManager::getAppPath() does however only check whether an app dir is present, independent of the enabled-state. Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
1 parent 792963f commit 3c54091

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/Command/App/Install.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace OC\Core\Command\App;
1010

1111
use OC\Installer;
12+
use OCP\App\AppPathNotFoundException;
1213
use OCP\App\IAppManager;
1314
use Symfony\Component\Console\Command\Command;
1415
use Symfony\Component\Console\Input\InputArgument;
@@ -58,9 +59,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5859
$appId = $input->getArgument('app-id');
5960
$forceEnable = (bool)$input->getOption('force');
6061

61-
if ($this->appManager->isEnabledForAnyone($appId)) {
62+
try {
63+
$this->appManager->getAppPath($appId);
6264
$output->writeln($appId . ' already installed');
6365
return 1;
66+
} catch (AppPathNotFoundException) {
6467
}
6568

6669
try {

0 commit comments

Comments
 (0)