diff options
Diffstat (limited to 'core/Command/App')
-rw-r--r-- | core/Command/App/Disable.php | 3 | ||||
-rw-r--r-- | core/Command/App/Enable.php | 16 | ||||
-rw-r--r-- | core/Command/App/GetPath.php | 4 | ||||
-rw-r--r-- | core/Command/App/Install.php | 4 | ||||
-rw-r--r-- | core/Command/App/ListApps.php | 13 | ||||
-rw-r--r-- | core/Command/App/Remove.php | 8 | ||||
-rw-r--r-- | core/Command/App/Update.php | 7 |
7 files changed, 28 insertions, 27 deletions
diff --git a/core/Command/App/Disable.php b/core/Command/App/Disable.php index e1f9c2a4d72..121ad3f010c 100644 --- a/core/Command/App/Disable.php +++ b/core/Command/App/Disable.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only @@ -44,7 +45,7 @@ class Disable extends Command implements CompletionAwareInterface { } private function disableApp(string $appId, OutputInterface $output): void { - if ($this->appManager->isInstalled($appId) === false) { + if ($this->appManager->isEnabledForAnyone($appId) === false) { $output->writeln('No such app enabled: ' . $appId); return; } diff --git a/core/Command/App/Enable.php b/core/Command/App/Enable.php index e34417599e2..3936acfbf6e 100644 --- a/core/Command/App/Enable.php +++ b/core/Command/App/Enable.php @@ -27,6 +27,7 @@ class Enable extends Command implements CompletionAwareInterface { public function __construct( protected IAppManager $appManager, protected IGroupManager $groupManager, + private Installer $installer, ) { parent::__construct(); } @@ -57,7 +58,7 @@ class Enable extends Command implements CompletionAwareInterface { protected function execute(InputInterface $input, OutputInterface $output): int { $appIds = $input->getArgument('app-id'); $groups = $this->resolveGroupIds($input->getOption('groups')); - $forceEnable = (bool) $input->getOption('force'); + $forceEnable = (bool)$input->getOption('force'); foreach ($appIds as $appId) { $this->enableApp($appId, $groups, $forceEnable, $output); @@ -77,20 +78,17 @@ class Enable extends Command implements CompletionAwareInterface { return $group->getDisplayName(); }, $groupIds); - if ($this->appManager->isInstalled($appId) && $groupIds === []) { + if ($this->appManager->isEnabledForUser($appId) && $groupIds === []) { $output->writeln($appId . ' already enabled'); return; } try { - /** @var Installer $installer */ - $installer = \OC::$server->query(Installer::class); - - if ($installer->isDownloaded($appId) === false) { - $installer->downloadApp($appId); + if ($this->installer->isDownloaded($appId) === false) { + $this->installer->downloadApp($appId); } - $installer->installApp($appId, $forceEnable); + $this->installer->installApp($appId, $forceEnable); $appVersion = $this->appManager->getAppVersion($appId); if ($groupIds === []) { @@ -145,7 +143,7 @@ class Enable extends Command implements CompletionAwareInterface { */ public function completeArgumentValues($argumentName, CompletionContext $context): array { if ($argumentName === 'app-id') { - $allApps = \OC_App::getAllApps(); + $allApps = $this->appManager->getAllAppsInAppsFolders(); return array_diff($allApps, \OC_App::getEnabledApps(true, true)); } return []; diff --git a/core/Command/App/GetPath.php b/core/Command/App/GetPath.php index 5eedcbe4182..3ba4ed7781b 100644 --- a/core/Command/App/GetPath.php +++ b/core/Command/App/GetPath.php @@ -40,7 +40,7 @@ class GetPath extends Base { /** * Executes the current command. * - * @param InputInterface $input An InputInterface instance + * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * @return int 0 if everything went fine, or an error code */ @@ -63,7 +63,7 @@ class GetPath extends Base { */ public function completeArgumentValues($argumentName, CompletionContext $context): array { if ($argumentName === 'app') { - return \OC_App::getAllApps(); + return $this->appManager->getAllAppsInAppsFolders(); } return []; } diff --git a/core/Command/App/Install.php b/core/Command/App/Install.php index aa263a8f3bf..c8a396c8e36 100644 --- a/core/Command/App/Install.php +++ b/core/Command/App/Install.php @@ -56,9 +56,9 @@ class Install extends Command { protected function execute(InputInterface $input, OutputInterface $output): int { $appId = $input->getArgument('app-id'); - $forceEnable = (bool) $input->getOption('force'); + $forceEnable = (bool)$input->getOption('force'); - if ($this->appManager->isInstalled($appId)) { + if ($this->appManager->isEnabledForAnyone($appId)) { $output->writeln($appId . ' already installed'); return 1; } diff --git a/core/Command/App/ListApps.php b/core/Command/App/ListApps.php index 6512c9e064c..dc947bea55f 100644 --- a/core/Command/App/ListApps.php +++ b/core/Command/App/ListApps.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only @@ -14,7 +15,7 @@ use Symfony\Component\Console\Output\OutputInterface; class ListApps extends Base { public function __construct( - protected IAppManager $manager, + protected IAppManager $appManager, ) { parent::__construct(); } @@ -56,16 +57,16 @@ class ListApps extends Base { $showEnabledApps = $input->getOption('enabled') || !$input->getOption('disabled'); $showDisabledApps = $input->getOption('disabled') || !$input->getOption('enabled'); - $apps = \OC_App::getAllApps(); + $apps = $this->appManager->getAllAppsInAppsFolders(); $enabledApps = $disabledApps = []; - $versions = \OC_App::getAppVersions(); + $versions = $this->appManager->getAppInstalledVersions(); //sort enabled apps above disabled apps foreach ($apps as $app) { - if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter) { + if ($shippedFilter !== null && $this->appManager->isShipped($app) !== $shippedFilter) { continue; } - if ($this->manager->isInstalled($app)) { + if ($this->appManager->isEnabledForAnyone($app)) { $enabledApps[] = $app; } else { $disabledApps[] = $app; @@ -88,7 +89,7 @@ class ListApps extends Base { sort($disabledApps); foreach ($disabledApps as $app) { - $apps['disabled'][$app] = $this->manager->getAppVersion($app) . (isset($versions[$app]) ? ' (installed ' . $versions[$app] . ')' : ''); + $apps['disabled'][$app] = $this->appManager->getAppVersion($app) . (isset($versions[$app]) ? ' (installed ' . $versions[$app] . ')' : ''); } } diff --git a/core/Command/App/Remove.php b/core/Command/App/Remove.php index ee60fcc0827..d43bfa96ccc 100644 --- a/core/Command/App/Remove.php +++ b/core/Command/App/Remove.php @@ -49,9 +49,9 @@ class Remove extends Command implements CompletionAwareInterface { protected function execute(InputInterface $input, OutputInterface $output): int { $appId = $input->getArgument('app-id'); - // Check if the app is installed - if (!$this->manager->isInstalled($appId)) { - $output->writeln($appId . ' is not installed'); + // Check if the app is enabled + if (!$this->manager->isEnabledForAnyone($appId)) { + $output->writeln($appId . ' is not enabled'); return 1; } @@ -117,7 +117,7 @@ class Remove extends Command implements CompletionAwareInterface { */ public function completeArgumentValues($argumentName, CompletionContext $context): array { if ($argumentName === 'app-id') { - return $this->manager->getInstalledApps(); + return $this->manager->getEnabledApps(); } return []; } diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php index 36422b4727c..71c7f84e5b0 100644 --- a/core/Command/App/Update.php +++ b/core/Command/App/Update.php @@ -9,6 +9,7 @@ declare(strict_types=1); namespace OC\Core\Command\App; use OC\Installer; +use OCP\App\AppPathNotFoundException; use OCP\App\IAppManager; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Command\Command; @@ -64,14 +65,14 @@ class Update extends Command { $apps = [$singleAppId]; try { $this->manager->getAppPath($singleAppId); - } catch (\OCP\App\AppPathNotFoundException $e) { + } catch (AppPathNotFoundException $e) { $output->writeln($singleAppId . ' not installed'); return 1; } } elseif ($input->getOption('all') || $input->getOption('showonly')) { - $apps = \OC_App::getAllApps(); + $apps = $this->manager->getAllAppsInAppsFolders(); } else { - $output->writeln("<error>Please specify an app to update or \"--all\" to update all updatable apps\"</error>"); + $output->writeln('<error>Please specify an app to update or "--all" to update all updatable apps"</error>'); return 1; } |