aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/Command/Config/App/Base.php2
-rw-r--r--core/Command/Config/App/SetConfig.php25
-rw-r--r--core/Command/Config/ListConfigs.php7
3 files changed, 13 insertions, 21 deletions
diff --git a/core/Command/Config/App/Base.php b/core/Command/Config/App/Base.php
index 07341c4faf9..e90a8e78f5b 100644
--- a/core/Command/Config/App/Base.php
+++ b/core/Command/Config/App/Base.php
@@ -7,12 +7,14 @@ declare(strict_types=1);
*/
namespace OC\Core\Command\Config\App;
+use OC\Config\ConfigManager;
use OCP\IAppConfig;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
abstract class Base extends \OC\Core\Command\Base {
public function __construct(
protected IAppConfig $appConfig,
+ protected readonly ConfigManager $configManager,
) {
parent::__construct();
}
diff --git a/core/Command/Config/App/SetConfig.php b/core/Command/Config/App/SetConfig.php
index 345067cfd45..1f4ab81bf05 100644
--- a/core/Command/Config/App/SetConfig.php
+++ b/core/Command/Config/App/SetConfig.php
@@ -9,7 +9,6 @@ declare(strict_types=1);
namespace OC\Core\Command\Config\App;
use OC\AppConfig;
-use OCP\Exceptions\AppConfigIncorrectTypeException;
use OCP\Exceptions\AppConfigUnknownKeyException;
use OCP\IAppConfig;
use Symfony\Component\Console\Helper\QuestionHelper;
@@ -161,7 +160,6 @@ class SetConfig extends Base {
}
$value = (string)$input->getOption('value');
-
switch ($type) {
case IAppConfig::VALUE_MIXED:
$updated = $this->appConfig->setValueMixed($appName, $configName, $value, $lazy, $sensitive);
@@ -172,34 +170,19 @@ class SetConfig extends Base {
break;
case IAppConfig::VALUE_INT:
- if ($value !== ((string)((int)$value))) {
- throw new AppConfigIncorrectTypeException('Value is not an integer');
- }
- $updated = $this->appConfig->setValueInt($appName, $configName, (int)$value, $lazy, $sensitive);
+ $updated = $this->appConfig->setValueInt($appName, $configName, $this->configManager->convertToInt($value), $lazy, $sensitive);
break;
case IAppConfig::VALUE_FLOAT:
- if ($value !== ((string)((float)$value))) {
- throw new AppConfigIncorrectTypeException('Value is not a float');
- }
- $updated = $this->appConfig->setValueFloat($appName, $configName, (float)$value, $lazy, $sensitive);
+ $updated = $this->appConfig->setValueFloat($appName, $configName, $this->configManager->convertToFloat($value), $lazy, $sensitive);
break;
case IAppConfig::VALUE_BOOL:
- if (in_array(strtolower($value), ['true', '1', 'on', 'yes'])) {
- $valueBool = true;
- } elseif (in_array(strtolower($value), ['false', '0', 'off', 'no'])) {
- $valueBool = false;
- } else {
- throw new AppConfigIncorrectTypeException('Value is not a boolean, please use \'true\' or \'false\'');
- }
- $updated = $this->appConfig->setValueBool($appName, $configName, $valueBool, $lazy);
+ $updated = $this->appConfig->setValueBool($appName, $configName, $this->configManager->convertToBool($value), $lazy);
break;
case IAppConfig::VALUE_ARRAY:
- $valueArray = json_decode($value, true, flags: JSON_THROW_ON_ERROR);
- $valueArray = (is_array($valueArray)) ? $valueArray : throw new AppConfigIncorrectTypeException('Value is not an array');
- $updated = $this->appConfig->setValueArray($appName, $configName, $valueArray, $lazy, $sensitive);
+ $updated = $this->appConfig->setValueArray($appName, $configName, $this->configManager->convertToArray($value), $lazy, $sensitive);
break;
}
}
diff --git a/core/Command/Config/ListConfigs.php b/core/Command/Config/ListConfigs.php
index 094348dd9ba..b81bfbf4d18 100644
--- a/core/Command/Config/ListConfigs.php
+++ b/core/Command/Config/ListConfigs.php
@@ -7,6 +7,7 @@
*/
namespace OC\Core\Command\Config;
+use OC\Config\ConfigManager;
use OC\Core\Command\Base;
use OC\SystemConfig;
use OCP\IAppConfig;
@@ -22,6 +23,7 @@ class ListConfigs extends Base {
public function __construct(
protected SystemConfig $systemConfig,
protected IAppConfig $appConfig,
+ protected ConfigManager $configManager,
) {
parent::__construct();
}
@@ -44,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')
;
}
@@ -51,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;