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.php40
1 files changed, 9 insertions, 31 deletions
diff --git a/core/Command/App/Enable.php b/core/Command/App/Enable.php
index 579432a1dd0..3936acfbf6e 100644
--- a/core/Command/App/Enable.php
+++ b/core/Command/App/Enable.php
@@ -3,28 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Joas Schilling <coding@schilljs.com>
- * @author John Molakvoæ <skjnldsv@protonmail.com>
- * @author Robin Appelman <robin@icewind.nl>
- * @author Sander Ruitenbeek <s.ruitenbeek@getgoing.nl>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OC\Core\Command\App;
@@ -47,6 +27,7 @@ class Enable extends Command implements CompletionAwareInterface {
public function __construct(
protected IAppManager $appManager,
protected IGroupManager $groupManager,
+ private Installer $installer,
) {
parent::__construct();
}
@@ -77,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);
@@ -97,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 === []) {
@@ -165,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 [];