From 08907ee3e9a4267daa2268f20ed9dee3c9cc3328 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Sun, 27 Jan 2019 12:28:57 +0100 Subject: [PATCH 1/6] Enable multiple apps at once Signed-off-by: Daniel Kesselberg --- core/Command/App/Enable.php | 84 +++++++++++++++----- core/register_command.php | 2 +- tests/Core/Command/Apps/AppsEnableTest.php | 89 ++++++++++++++++++++++ 3 files changed, 153 insertions(+), 22 deletions(-) create mode 100644 tests/Core/Command/Apps/AppsEnableTest.php diff --git a/core/Command/App/Enable.php b/core/Command/App/Enable.php index 2d8bd76e85..c91e715e1f 100644 --- a/core/Command/App/Enable.php +++ b/core/Command/App/Enable.php @@ -26,8 +26,10 @@ namespace OC\Core\Command\App; +use OCP\App\AppPathNotFoundException; use OCP\App\IAppManager; use OCP\IGroup; +use OCP\IGroupManager; use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface; use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; use Symfony\Component\Console\Command\Command; @@ -39,23 +41,31 @@ use Symfony\Component\Console\Output\OutputInterface; class Enable extends Command implements CompletionAwareInterface { /** @var IAppManager */ - protected $manager; + protected $appManager; + + /** @var IGroupManager */ + protected $groupManager; + + /** @var int */ + protected $exitCode = 0; /** - * @param IAppManager $manager + * @param IAppManager $appManager + * @param IGroupManager $groupManager */ - public function __construct(IAppManager $manager) { + public function __construct(IAppManager $appManager, IGroupManager $groupManager) { parent::__construct(); - $this->manager = $manager; + $this->appManager = $appManager; + $this->groupManager = $groupManager; } - protected function configure() { + protected function configure(): void { $this ->setName('app:enable') ->setDescription('enable an app') ->addArgument( 'app-id', - InputArgument::REQUIRED, + InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'enable the specified app' ) ->addOption( @@ -63,28 +73,60 @@ class Enable extends Command implements CompletionAwareInterface { 'g', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'enable the app only for a list of groups' - ) - ; + ); } protected function execute(InputInterface $input, OutputInterface $output) { - $appId = $input->getArgument('app-id'); + $appIds = $input->getArgument('app-id'); + $groups = $this->resolveGroupIds($input->getOption('groups')); - if (!\OC_App::getAppPath($appId)) { + foreach ($appIds as $appId) { + $this->enableApp($appId, $groups, $output); + } + + return $this->exitCode; + } + + /** + * @param string $appId + * @param array $groupIds + * @param OutputInterface $output + */ + private function enableApp(string $appId, array $groupIds, OutputInterface $output): void { + $groupNames = array_map(function (IGroup $group) { + return $group->getDisplayName(); + }, $groupIds); + + try { + if ($groupIds === []) { + $this->appManager->enableApp($appId); + $output->writeln($appId . ' enabled'); + } else { + $this->appManager->enableAppForGroups($appId, $groupIds); + $output->writeln($appId . ' enabled for groups: ' . implode(', ', $groupNames)); + } + } catch (AppPathNotFoundException $e) { $output->writeln($appId . ' not found'); - return 1; + $this->exitCode = 1; + } catch (\Exception $e) { + $output->writeln($e->getMessage()); + $this->exitCode = 1; } + } - $groups = $input->getOption('groups'); - $appClass = new \OC_App(); - if (empty($groups)) { - $appClass->enable($appId); - $output->writeln($appId . ' enabled'); - } else { - $appClass->enable($appId, $groups); - $output->writeln($appId . ' enabled for groups: ' . implode(', ', $groups)); + /** + * @param array $groupIds + * @return array + */ + private function resolveGroupIds(array $groupIds): array { + $groups = []; + foreach ($groupIds as $groupId) { + $group = $this->groupManager->get($groupId); + if ($group instanceof IGroup) { + $groups[] = $group; + } } - return 0; + return $groups; } /** @@ -94,7 +136,7 @@ class Enable extends Command implements CompletionAwareInterface { */ public function completeOptionValues($optionName, CompletionContext $context) { if ($optionName === 'groups') { - return array_map(function(IGroup $group) { + return array_map(function (IGroup $group) { return $group->getGID(); }, \OC::$server->getGroupManager()->search($context->getCurrentWord())); } diff --git a/core/register_command.php b/core/register_command.php index 15bb37e433..6bd1b1b18a 100644 --- a/core/register_command.php +++ b/core/register_command.php @@ -61,7 +61,7 @@ $application->add(new \OC\Core\Command\Integrity\CheckCore( if (\OC::$server->getConfig()->getSystemValue('installed', false)) { $application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager())); - $application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager())); + $application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager(), \OC::$server->getGroupManager())); $application->add(new OC\Core\Command\App\Install()); $application->add(new OC\Core\Command\App\GetPath()); $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager())); diff --git a/tests/Core/Command/Apps/AppsEnableTest.php b/tests/Core/Command/Apps/AppsEnableTest.php new file mode 100644 index 0000000000..e1192d5124 --- /dev/null +++ b/tests/Core/Command/Apps/AppsEnableTest.php @@ -0,0 +1,89 @@ +. + * + */ + +namespace Tests\Core\Command\Config; + +use OC\Core\Command\App\Enable; +use Symfony\Component\Console\Tester\CommandTester; +use Test\TestCase; + +/** + * Class AppsEnableTest + * + * @group DB + */ +class AppsEnableTest extends TestCase { + + /** @var CommandTester */ + private $commandTester; + + public function setUp() { + parent::setUp(); + + $command = new Enable( + \OC::$server->getAppManager(), + \OC::$server->getGroupManager() + ); + + $this->commandTester = new CommandTester($command); + } + + /** + * @dataProvider dataCommandInput + * @param $appId + * @param $groups + * @param $statusCode + * @param $output + */ + public function testCommandInput($appId, $groups, $statusCode, $output) { + $input = ['app-id' => $appId]; + + if (is_array($groups)) { + $input['--groups'] = $groups; + } + + $this->commandTester->execute($input); + + $this->assertContains($output, $this->commandTester->getDisplay()); + $this->assertSame($statusCode, $this->commandTester->getStatusCode()); + } + + public function dataCommandInput() { + return [ + [['admin_audit'], null, 0, 'admin_audit enabled'], + [['comments'], null, 0, 'comments enabled'], + [['invalid_app'], null, 1, 'invalid_app not found'], + + [['admin_audit', 'comments'], null, 0, "admin_audit enabled\ncomments enabled"], + [['admin_audit', 'comments', 'invalid_app'], null, 1, "admin_audit enabled\ncomments enabled\ninvalid_app not found"], + + [['admin_audit'], ['admin'], 1, "admin_audit can't be enabled for groups"], + [['comments'], ['admin'], 1, "comments can't be enabled for groups"], + + [['updatenotification'], ['admin'], 0, 'updatenotification enabled for groups: admin'], + [['updatenotification', 'logreader'], ['admin'], 0, "updatenotification enabled for groups: admin\nlogreader enabled for groups: admin"], + + [['updatenotification'], ['admin', 'invalid_group'], 0, 'updatenotification enabled for groups: admin'], + [['updatenotification', 'logreader'], ['admin', 'invalid_group'], 0, "updatenotification enabled for groups: admin\nlogreader enabled for groups: admin"], + [['updatenotification', 'logreader', 'invalid_app'], ['admin', 'invalid_group'], 0, "updatenotification enabled for groups: admin\nlogreader enabled for groups: admin"], + ]; + } +} From 03d31926385624abe4b24b98dee93e132049889c Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Sun, 27 Jan 2019 14:34:39 +0100 Subject: [PATCH 2/6] Disable multiple apps at once Signed-off-by: Daniel Kesselberg --- core/Command/App/Disable.php | 47 +++++++----- tests/Core/Command/Apps/AppsDisableTest.php | 84 +++++++++++++++++++++ 2 files changed, 114 insertions(+), 17 deletions(-) create mode 100644 tests/Core/Command/Apps/AppsDisableTest.php diff --git a/core/Command/App/Disable.php b/core/Command/App/Disable.php index b64e309bd9..a79c9c474d 100644 --- a/core/Command/App/Disable.php +++ b/core/Command/App/Disable.php @@ -36,39 +36,52 @@ use Symfony\Component\Console\Output\OutputInterface; class Disable extends Command implements CompletionAwareInterface { /** @var IAppManager */ - protected $manager; + protected $appManager; + + /** @var int */ + protected $exitCode = 0; /** - * @param IAppManager $manager + * @param IAppManager $appManager */ - public function __construct(IAppManager $manager) { + public function __construct(IAppManager $appManager) { parent::__construct(); - $this->manager = $manager; + $this->appManager = $appManager; } - protected function configure() { + protected function configure(): void { $this ->setName('app:disable') ->setDescription('disable an app') ->addArgument( 'app-id', - InputArgument::REQUIRED, + InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'disable the specified app' ); } protected function execute(InputInterface $input, OutputInterface $output) { - $appId = $input->getArgument('app-id'); - if ($this->manager->isInstalled($appId)) { - try { - $this->manager->disableApp($appId); - $output->writeln($appId . ' disabled'); - } catch(\Exception $e) { - $output->writeln($e->getMessage()); - return 2; - } - } else { + $appIds = $input->getArgument('app-id'); + + foreach ($appIds as $appId) { + $this->disableApp($appId, $output); + } + + return $this->exitCode; + } + + private function disableApp(string $appId, OutputInterface $output): void { + if ($this->appManager->isInstalled($appId) === false) { $output->writeln('No such app enabled: ' . $appId); + return; + } + + try { + $this->appManager->disableApp($appId); + $output->writeln($appId . ' disabled'); + } catch (\Exception $e) { + $output->writeln($e->getMessage()); + $this->exitCode = 2; } } @@ -88,7 +101,7 @@ class Disable extends Command implements CompletionAwareInterface { */ public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'app-id') { - return array_diff(\OC_App::getEnabledApps(true, true), $this->manager->getAlwaysEnabledApps()); + return array_diff(\OC_App::getEnabledApps(true, true), $this->appManager->getAlwaysEnabledApps()); } return []; } diff --git a/tests/Core/Command/Apps/AppsDisableTest.php b/tests/Core/Command/Apps/AppsDisableTest.php new file mode 100644 index 0000000000..1e3c4019f5 --- /dev/null +++ b/tests/Core/Command/Apps/AppsDisableTest.php @@ -0,0 +1,84 @@ +. + * + */ + +namespace Tests\Core\Command\Config; + +use OC\Core\Command\App\Disable; +use Symfony\Component\Console\Tester\CommandTester; +use Test\TestCase; + +/** + * Class AppsDisableTest + * + * @group DB + */ +class AppsDisableTest extends TestCase { + + /** @var CommandTester */ + private $commandTester; + + public function setUp() { + parent::setUp(); + + $command = new Disable( + \OC::$server->getAppManager() + ); + + $this->commandTester = new CommandTester($command); + + \OC::$server->getAppManager()->enableApp('admin_audit'); + \OC::$server->getAppManager()->enableApp('comments'); + } + + /** + * @dataProvider dataCommandInput + * @param $appId + * @param $groups + * @param $statusCode + * @param $output + */ + public function testCommandInput($appId, $statusCode, $output) { + $input = ['app-id' => $appId]; + + $this->commandTester->execute($input); + + $this->assertContains($output, $this->commandTester->getDisplay()); + $this->assertSame($statusCode, $this->commandTester->getStatusCode()); + } + + public function dataCommandInput() { + return [ + [['admin_audit'], 0, 'admin_audit disabled'], + [['comments'], 0, 'comments disabled'], + [['invalid_app'], 0, 'No such app enabled: invalid_app'], + + [['admin_audit', 'comments'], 0, "admin_audit disabled\ncomments disabled"], + [['admin_audit', 'comments', 'invalid_app'], 0, "admin_audit disabled\ncomments disabled\nNo such app enabled: invalid_app"], + + [['files'], 2, "files can't be disabled"], + [['provisioning_api'], 2, "provisioning_api can't be disabled"], + + [['files', 'admin_audit'], 2, "files can't be disabled.\nadmin_audit disabled"], + [['provisioning_api', 'comments'], 2, "provisioning_api can't be disabled.\ncomments disabled"], + + ]; + } +} From 76b5f44f05f3ea9f56707ed0f6c4bff2fa7673e8 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Sun, 27 Jan 2019 14:47:19 +0100 Subject: [PATCH 3/6] Strict Types, Return Types Signed-off-by: Daniel Kesselberg --- .drone.yml | 4 ---- build/integration/run.sh | 8 ++++---- tests/Core/Command/Apps/AppsDisableTest.php | 5 +++-- tests/Core/Command/Apps/AppsEnableTest.php | 8 ++++++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.drone.yml b/.drone.yml index 172a739a04..b468031fd1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -562,7 +562,6 @@ pipeline: image: nextcloudci/integration-php7.1:1 commands: - ./occ maintenance:install --admin-pass=admin --data-dir=/dev/shm/nc_int - - ./occ app:enable user_ldap - cd build/integration - ./run.sh ldap_features/ldap-ocs.feature when: @@ -577,7 +576,6 @@ pipeline: - ./occ config:system:set redis timeout --value=0 --type=integer - ./occ config:system:set --type string --value "\\OC\\Memcache\\Redis" memcache.local - ./occ config:system:set --type string --value "\\OC\\Memcache\\Redis" memcache.distributed - - ./occ app:enable user_ldap - cd build/integration - ./run.sh ldap_features/ldap-openldap.feature when: @@ -592,7 +590,6 @@ pipeline: - ./occ config:system:set redis timeout --value=0 --type=integer - ./occ config:system:set --type string --value "\\OC\\Memcache\\Redis" memcache.local - ./occ config:system:set --type string --value "\\OC\\Memcache\\Redis" memcache.distributed - - ./occ app:enable user_ldap - cd build/integration - ./run.sh ldap_features/openldap-uid-username.feature when: @@ -607,7 +604,6 @@ pipeline: - ./occ config:system:set redis timeout --value=0 --type=integer - ./occ config:system:set --type string --value "\\OC\\Memcache\\Redis" memcache.local - ./occ config:system:set --type string --value "\\OC\\Memcache\\Redis" memcache.distributed - - ./occ app:enable user_ldap - cd build/integration - ./run.sh ldap_features/openldap-numerical-id.feature when: diff --git a/build/integration/run.sh b/build/integration/run.sh index 56f4ee7b07..e13a77c27b 100755 --- a/build/integration/run.sh +++ b/build/integration/run.sh @@ -48,8 +48,9 @@ export TEST_SERVER_FED_URL="http://localhost:$PORT_FED/ocs/" if [ "$INSTALLED" == "true" ]; then #Enable external storage app - $OCC app:enable files_external - $OCC app:enable user_ldap + $OCC app:install --keep-disabled files_external + $OCC app:install --keep-disabled user_ldap + $OCC app:enable files_external user_ldap mkdir -p work/local_storage OUTPUT_CREATE_STORAGE=`$OCC files_external:create local_storage local null::null -c datadir=$PWD/work/local_storage` @@ -71,8 +72,7 @@ if [ "$INSTALLED" == "true" ]; then $OCC files_external:delete -y $ID_STORAGE #Disable external storage app - $OCC app:disable files_external - $OCC app:disable user_ldap + $OCC app:disable files_external user_ldap fi if [ -z $HIDE_OC_LOGS ]; then diff --git a/tests/Core/Command/Apps/AppsDisableTest.php b/tests/Core/Command/Apps/AppsDisableTest.php index 1e3c4019f5..d9c43a79c2 100644 --- a/tests/Core/Command/Apps/AppsDisableTest.php +++ b/tests/Core/Command/Apps/AppsDisableTest.php @@ -1,4 +1,5 @@ $appId]; $this->commandTester->execute($input); @@ -64,7 +65,7 @@ class AppsDisableTest extends TestCase { $this->assertSame($statusCode, $this->commandTester->getStatusCode()); } - public function dataCommandInput() { + public function dataCommandInput(): array { return [ [['admin_audit'], 0, 'admin_audit disabled'], [['comments'], 0, 'comments disabled'], diff --git a/tests/Core/Command/Apps/AppsEnableTest.php b/tests/Core/Command/Apps/AppsEnableTest.php index e1192d5124..43f377c70a 100644 --- a/tests/Core/Command/Apps/AppsEnableTest.php +++ b/tests/Core/Command/Apps/AppsEnableTest.php @@ -1,4 +1,5 @@ commandTester = new CommandTester($command); + + \OC::$server->getAppManager()->disableApp('admin_audit'); + \OC::$server->getAppManager()->disableApp('comments'); } /** @@ -53,7 +57,7 @@ class AppsEnableTest extends TestCase { * @param $statusCode * @param $output */ - public function testCommandInput($appId, $groups, $statusCode, $output) { + public function testCommandInput($appId, $groups, $statusCode, $output): void { $input = ['app-id' => $appId]; if (is_array($groups)) { @@ -66,7 +70,7 @@ class AppsEnableTest extends TestCase { $this->assertSame($statusCode, $this->commandTester->getStatusCode()); } - public function dataCommandInput() { + public function dataCommandInput(): array { return [ [['admin_audit'], null, 0, 'admin_audit enabled'], [['comments'], null, 0, 'comments enabled'], From 75b7d6ae4e13c62cc26c47122a6913159d7f6bc8 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Sun, 27 Jan 2019 21:53:09 +0100 Subject: [PATCH 4/6] Add install logic for enable command Signed-off-by: Daniel Kesselberg --- build/integration/run.sh | 2 -- core/Command/App/Enable.php | 11 +++++++++++ tests/Core/Command/Apps/AppsEnableTest.php | 6 +++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/build/integration/run.sh b/build/integration/run.sh index e13a77c27b..fc6e35f078 100755 --- a/build/integration/run.sh +++ b/build/integration/run.sh @@ -48,8 +48,6 @@ export TEST_SERVER_FED_URL="http://localhost:$PORT_FED/ocs/" if [ "$INSTALLED" == "true" ]; then #Enable external storage app - $OCC app:install --keep-disabled files_external - $OCC app:install --keep-disabled user_ldap $OCC app:enable files_external user_ldap mkdir -p work/local_storage diff --git a/core/Command/App/Enable.php b/core/Command/App/Enable.php index c91e715e1f..7583375317 100644 --- a/core/Command/App/Enable.php +++ b/core/Command/App/Enable.php @@ -26,6 +26,7 @@ namespace OC\Core\Command\App; +use OC\Installer; use OCP\App\AppPathNotFoundException; use OCP\App\IAppManager; use OCP\IGroup; @@ -97,7 +98,17 @@ class Enable extends Command implements CompletionAwareInterface { return $group->getDisplayName(); }, $groupIds); + try { + /** @var Installer $installer */ + $installer = \OC::$server->query(Installer::class); + + if (false === $installer->isDownloaded($appId)) { + $installer->downloadApp($appId); + } + + $installer->installApp($appId); + if ($groupIds === []) { $this->appManager->enableApp($appId); $output->writeln($appId . ' enabled'); diff --git a/tests/Core/Command/Apps/AppsEnableTest.php b/tests/Core/Command/Apps/AppsEnableTest.php index 43f377c70a..2d0ffd9f95 100644 --- a/tests/Core/Command/Apps/AppsEnableTest.php +++ b/tests/Core/Command/Apps/AppsEnableTest.php @@ -74,10 +74,10 @@ class AppsEnableTest extends TestCase { return [ [['admin_audit'], null, 0, 'admin_audit enabled'], [['comments'], null, 0, 'comments enabled'], - [['invalid_app'], null, 1, 'invalid_app not found'], + [['invalid_app'], null, 1, 'Could not download app invalid_app'], [['admin_audit', 'comments'], null, 0, "admin_audit enabled\ncomments enabled"], - [['admin_audit', 'comments', 'invalid_app'], null, 1, "admin_audit enabled\ncomments enabled\ninvalid_app not found"], + [['admin_audit', 'comments', 'invalid_app'], null, 1, "admin_audit enabled\ncomments enabled\nCould not download app invalid_app"], [['admin_audit'], ['admin'], 1, "admin_audit can't be enabled for groups"], [['comments'], ['admin'], 1, "comments can't be enabled for groups"], @@ -87,7 +87,7 @@ class AppsEnableTest extends TestCase { [['updatenotification'], ['admin', 'invalid_group'], 0, 'updatenotification enabled for groups: admin'], [['updatenotification', 'logreader'], ['admin', 'invalid_group'], 0, "updatenotification enabled for groups: admin\nlogreader enabled for groups: admin"], - [['updatenotification', 'logreader', 'invalid_app'], ['admin', 'invalid_group'], 0, "updatenotification enabled for groups: admin\nlogreader enabled for groups: admin"], + [['updatenotification', 'logreader', 'invalid_app'], ['admin', 'invalid_group'], 1, "updatenotification enabled for groups: admin\nlogreader enabled for groups: admin\nCould not download app invalid_app"], ]; } } From bb2d8bafc9e89c03830b863941954db74a0b067e Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Mon, 28 Jan 2019 16:12:09 +0100 Subject: [PATCH 5/6] Use contacts instead of logreader Logreader is not distributed by app store because shipped by default. Signed-off-by: Daniel Kesselberg --- tests/Core/Command/Apps/AppsEnableTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Core/Command/Apps/AppsEnableTest.php b/tests/Core/Command/Apps/AppsEnableTest.php index 2d0ffd9f95..bfec710f1b 100644 --- a/tests/Core/Command/Apps/AppsEnableTest.php +++ b/tests/Core/Command/Apps/AppsEnableTest.php @@ -83,11 +83,11 @@ class AppsEnableTest extends TestCase { [['comments'], ['admin'], 1, "comments can't be enabled for groups"], [['updatenotification'], ['admin'], 0, 'updatenotification enabled for groups: admin'], - [['updatenotification', 'logreader'], ['admin'], 0, "updatenotification enabled for groups: admin\nlogreader enabled for groups: admin"], + [['updatenotification', 'contacts'], ['admin'], 0, "updatenotification enabled for groups: admin\ncontacts enabled for groups: admin"], [['updatenotification'], ['admin', 'invalid_group'], 0, 'updatenotification enabled for groups: admin'], - [['updatenotification', 'logreader'], ['admin', 'invalid_group'], 0, "updatenotification enabled for groups: admin\nlogreader enabled for groups: admin"], - [['updatenotification', 'logreader', 'invalid_app'], ['admin', 'invalid_group'], 1, "updatenotification enabled for groups: admin\nlogreader enabled for groups: admin\nCould not download app invalid_app"], + [['updatenotification', 'contacts'], ['admin', 'invalid_group'], 0, "updatenotification enabled for groups: admin\ncontacts enabled for groups: admin"], + [['updatenotification', 'contacts', 'invalid_app'], ['admin', 'invalid_group'], 1, "updatenotification enabled for groups: admin\ncontacts enabled for groups: admin\nCould not download app invalid_app"], ]; } } From 1d1068753f019580982297fee6c317fa89261d05 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Wed, 20 Feb 2019 18:05:21 +0100 Subject: [PATCH 6/6] Fix access to groupManager Signed-off-by: Daniel Kesselberg --- core/Command/App/Enable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/Command/App/Enable.php b/core/Command/App/Enable.php index 7583375317..ae763e57a8 100644 --- a/core/Command/App/Enable.php +++ b/core/Command/App/Enable.php @@ -149,7 +149,7 @@ class Enable extends Command implements CompletionAwareInterface { if ($optionName === 'groups') { return array_map(function (IGroup $group) { return $group->getGID(); - }, \OC::$server->getGroupManager()->search($context->getCurrentWord())); + }, $this->groupManager->search($context->getCurrentWord())); } return []; }