aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command/Config
diff options
context:
space:
mode:
Diffstat (limited to 'core/Command/Config')
-rw-r--r--core/Command/Config/App/Base.php14
-rw-r--r--core/Command/Config/App/DeleteConfig.php12
-rw-r--r--core/Command/Config/App/GetConfig.php7
-rw-r--r--core/Command/Config/App/SetConfig.php6
4 files changed, 13 insertions, 26 deletions
diff --git a/core/Command/Config/App/Base.php b/core/Command/Config/App/Base.php
index 7d3e9a83193..07341c4faf9 100644
--- a/core/Command/Config/App/Base.php
+++ b/core/Command/Config/App/Base.php
@@ -1,15 +1,21 @@
<?php
+
+declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Core\Command\Config\App;
-use OCP\IConfig;
+use OCP\IAppConfig;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
abstract class Base extends \OC\Core\Command\Base {
- protected IConfig $config;
+ public function __construct(
+ protected IAppConfig $appConfig,
+ ) {
+ parent::__construct();
+ }
/**
* @param string $argumentName
@@ -18,12 +24,12 @@ abstract class Base extends \OC\Core\Command\Base {
*/
public function completeArgumentValues($argumentName, CompletionContext $context) {
if ($argumentName === 'app') {
- return \OC_App::getAllApps();
+ return $this->appConfig->getApps();
}
if ($argumentName === 'name') {
$appName = $context->getWordAtIndex($context->getWordIndex() - 1);
- return $this->config->getAppKeys($appName);
+ return $this->appConfig->getKeys($appName);
}
return [];
}
diff --git a/core/Command/Config/App/DeleteConfig.php b/core/Command/Config/App/DeleteConfig.php
index 2e34197e541..5a08ecbdc42 100644
--- a/core/Command/Config/App/DeleteConfig.php
+++ b/core/Command/Config/App/DeleteConfig.php
@@ -1,5 +1,6 @@
<?php
+declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -7,19 +8,12 @@
*/
namespace OC\Core\Command\Config\App;
-use OCP\IConfig;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class DeleteConfig extends Base {
- public function __construct(
- protected IConfig $config,
- ) {
- parent::__construct();
- }
-
protected function configure() {
parent::configure();
@@ -49,12 +43,12 @@ class DeleteConfig extends Base {
$appName = $input->getArgument('app');
$configName = $input->getArgument('name');
- if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->config->getAppKeys($appName))) {
+ if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->appConfig->getKeys($appName), true)) {
$output->writeln('<error>Config ' . $configName . ' of app ' . $appName . ' could not be deleted because it did not exist</error>');
return 1;
}
- $this->config->deleteAppValue($appName, $configName);
+ $this->appConfig->deleteKey($appName, $configName);
$output->writeln('<info>Config value ' . $configName . ' of app ' . $appName . ' deleted</info>');
return 0;
}
diff --git a/core/Command/Config/App/GetConfig.php b/core/Command/Config/App/GetConfig.php
index f64efd3feaa..b68476a2e91 100644
--- a/core/Command/Config/App/GetConfig.php
+++ b/core/Command/Config/App/GetConfig.php
@@ -9,19 +9,12 @@ declare(strict_types=1);
namespace OC\Core\Command\Config\App;
use OCP\Exceptions\AppConfigUnknownKeyException;
-use OCP\IAppConfig;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class GetConfig extends Base {
- public function __construct(
- protected IAppConfig $appConfig,
- ) {
- parent::__construct();
- }
-
protected function configure() {
parent::configure();
diff --git a/core/Command/Config/App/SetConfig.php b/core/Command/Config/App/SetConfig.php
index e983d32d97e..345067cfd45 100644
--- a/core/Command/Config/App/SetConfig.php
+++ b/core/Command/Config/App/SetConfig.php
@@ -20,12 +20,6 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;
class SetConfig extends Base {
- public function __construct(
- protected IAppConfig $appConfig,
- ) {
- parent::__construct();
- }
-
protected function configure() {
parent::configure();