aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command/Config/ListConfigs.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/Command/Config/ListConfigs.php')
-rw-r--r--core/Command/Config/ListConfigs.php63
1 files changed, 22 insertions, 41 deletions
diff --git a/core/Command/Config/ListConfigs.php b/core/Command/Config/ListConfigs.php
index b19a09cec97..a7c195276eb 100644
--- a/core/Command/Config/ListConfigs.php
+++ b/core/Command/Config/ListConfigs.php
@@ -1,27 +1,13 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Joas Schilling <coding@schilljs.com>
- * @author Roeland Jago Douma <roeland@famdouma.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-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OC\Core\Command\Config;
+use OC\Config\ConfigManager;
use OC\Core\Command\Base;
use OC\SystemConfig;
use OCP\IAppConfig;
@@ -32,22 +18,14 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class ListConfigs extends Base {
- protected $defaultOutputFormat = self::OUTPUT_FORMAT_JSON_PRETTY;
-
- /** * @var SystemConfig */
- protected $systemConfig;
+ protected string $defaultOutputFormat = self::OUTPUT_FORMAT_JSON_PRETTY;
- /** @var IAppConfig */
- protected $appConfig;
-
- /**
- * @param SystemConfig $systemConfig
- * @param IAppConfig $appConfig
- */
- public function __construct(SystemConfig $systemConfig, IAppConfig $appConfig) {
+ public function __construct(
+ protected SystemConfig $systemConfig,
+ protected IAppConfig $appConfig,
+ protected ConfigManager $configManager,
+ ) {
parent::__construct();
- $this->systemConfig = $systemConfig;
- $this->appConfig = $appConfig;
}
protected function configure() {
@@ -68,6 +46,7 @@ class ListConfigs extends Base {
InputOption::VALUE_NONE,
'Use this option when you want to include sensitive configs like passwords, salts, ...'
)
+ ->addOption('migrate', null, InputOption::VALUE_NONE, 'Rename config keys of all enabled apps, based on ConfigLexicon')
;
}
@@ -75,6 +54,10 @@ class ListConfigs extends Base {
$app = $input->getArgument('app');
$noSensitiveValues = !$input->getOption('private');
+ if ($input->getOption('migrate')) {
+ $this->configManager->migrateConfigLexiconKeys(($app === 'all') ? null : $app);
+ }
+
if (!is_string($app)) {
$output->writeln('<error>Invalid app value given</error>');
return 1;
@@ -85,7 +68,7 @@ class ListConfigs extends Base {
$configs = [
'system' => $this->getSystemConfigs($noSensitiveValues),
];
- break;
+ break;
case 'all':
$apps = $this->appConfig->getApps();
@@ -96,13 +79,11 @@ class ListConfigs extends Base {
foreach ($apps as $appName) {
$configs['apps'][$appName] = $this->getAppConfigs($appName, $noSensitiveValues);
}
- break;
+ break;
default:
$configs = [
- 'apps' => [
- $app => $this->getAppConfigs($app, $noSensitiveValues),
- ],
+ 'apps' => [$app => $this->getAppConfigs($app, $noSensitiveValues)],
];
}
@@ -116,7 +97,7 @@ class ListConfigs extends Base {
* @param bool $noSensitiveValues
* @return array
*/
- protected function getSystemConfigs($noSensitiveValues) {
+ protected function getSystemConfigs(bool $noSensitiveValues): array {
$keys = $this->systemConfig->getKeys();
$configs = [];
@@ -142,9 +123,9 @@ class ListConfigs extends Base {
* @param bool $noSensitiveValues
* @return array
*/
- protected function getAppConfigs($app, $noSensitiveValues) {
+ protected function getAppConfigs(string $app, bool $noSensitiveValues) {
if ($noSensitiveValues) {
- return $this->appConfig->getFilteredValues($app, false);
+ return $this->appConfig->getFilteredValues($app);
} else {
return $this->appConfig->getValues($app, false);
}