aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command/App/Enable.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/Command/App/Enable.php')
-rw-r--r--core/Command/App/Enable.php16
1 files changed, 7 insertions, 9 deletions
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 [];