summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-12-09 14:47:28 +0100
committerJoas Schilling <nickvergessen@owncloud.com>2016-01-14 15:02:55 +0100
commitf2cb03e1553e50a7aa93197ba2c9805681d3d768 (patch)
tree780164e1c4ea30ea949a28bf4f30ff61ed9fdb8c /core
parenta06f0256a9ce0f928b6b658b1df92bafbf6b6086 (diff)
downloadnextcloud-server-f2cb03e1553e50a7aa93197ba2c9805681d3d768.tar.gz
nextcloud-server-f2cb03e1553e50a7aa93197ba2c9805681d3d768.zip
Allow array recursion in get
Diffstat (limited to 'core')
-rw-r--r--core/command/config/system/getconfig.php19
1 files changed, 16 insertions, 3 deletions
diff --git a/core/command/config/system/getconfig.php b/core/command/config/system/getconfig.php
index 80b41a68526..b76474112a0 100644
--- a/core/command/config/system/getconfig.php
+++ b/core/command/config/system/getconfig.php
@@ -48,8 +48,8 @@ class GetConfig extends Base {
->setDescription('Get a system config value')
->addArgument(
'name',
- InputArgument::REQUIRED,
- 'Name of the config to get'
+ InputArgument::REQUIRED | InputArgument::IS_ARRAY,
+ 'Name of the config to get, specify multiple for array parameter'
)
->addOption(
'default-value',
@@ -68,7 +68,8 @@ class GetConfig extends Base {
* @return null|int null or 0 if everything went fine, or an error code
*/
protected function execute(InputInterface $input, OutputInterface $output) {
- $configName = $input->getArgument('name');
+ $configNames = $input->getArgument('name');
+ $configName = array_shift($configNames);
$defaultValue = $input->getOption('default-value');
if (!in_array($configName, $this->systemConfig->getKeys()) && !$input->hasParameterOption('--default-value')) {
@@ -79,6 +80,18 @@ class GetConfig extends Base {
$configValue = $defaultValue;
} else {
$configValue = $this->systemConfig->getValue($configName);
+ if (!empty($configNames)) {
+ foreach ($configNames as $configName) {
+ if (isset($configValue[$configName])) {
+ $configValue = $configValue[$configName];
+ } else if (!$input->hasParameterOption('--default-value')) {
+ return 1;
+ } else {
+ $configValue = $defaultValue;
+ break;
+ }
+ }
+ }
}
$this->writeMixedInOutputFormat($input, $output, $configValue);