diff options
Diffstat (limited to 'core/command')
-rw-r--r-- | core/command/app/disable.php | 1 | ||||
-rw-r--r-- | core/command/app/enable.php | 1 | ||||
-rw-r--r-- | core/command/config/listconfigs.php | 45 |
3 files changed, 37 insertions, 10 deletions
diff --git a/core/command/app/disable.php b/core/command/app/disable.php index 21a88f0a923..f2096448279 100644 --- a/core/command/app/disable.php +++ b/core/command/app/disable.php @@ -47,6 +47,7 @@ class Disable extends Command { $output->writeln($appId . ' disabled'); } catch(\Exception $e) { $output->writeln($e->getMessage()); + return 2; } } else { $output->writeln('No such app enabled: ' . $appId); diff --git a/core/command/app/enable.php b/core/command/app/enable.php index 2e68cfa97ff..907006961dc 100644 --- a/core/command/app/enable.php +++ b/core/command/app/enable.php @@ -45,6 +45,7 @@ class Enable extends Command { $output->writeln($appId . ' is already enabled'); } else if (!\OC_App::getAppPath($appId)) { $output->writeln($appId . ' not found'); + return 1; } else { \OC_App::enable($appId); $output->writeln($appId . ' enabled'); diff --git a/core/command/config/listconfigs.php b/core/command/config/listconfigs.php index 34a0b7169fd..5796362f2fc 100644 --- a/core/command/config/listconfigs.php +++ b/core/command/config/listconfigs.php @@ -34,15 +34,18 @@ class ListConfigs extends Base { /** @var array */ protected $sensitiveValues = [ - 'dbpassword', - 'dbuser', - 'mail_smtpname', - 'mail_smtppassword', - 'passwordsalt', - 'secret', - 'ldap_agent_password', + 'dbpassword' => true, + 'dbuser' => true, + 'mail_smtpname' => true, + 'mail_smtppassword' => true, + 'passwordsalt' => true, + 'secret' => true, + 'ldap_agent_password' => true, + 'objectstore' => ['arguments' => ['password' => true]], ]; + const SENSITIVE_VALUE = '***REMOVED SENSITIVE VALUE***'; + /** * @var SystemConfig */ protected $systemConfig; @@ -124,11 +127,12 @@ class ListConfigs extends Base { $configs = []; foreach ($keys as $key) { - if ($noSensitiveValues && in_array($key, $this->sensitiveValues)) { - continue; + $value = $this->systemConfig->getValue($key, serialize(null)); + + if ($noSensitiveValues && isset($this->sensitiveValues[$key])) { + $value = $this->removeSensitiveValue($this->sensitiveValues[$key], $value); } - $value = $this->systemConfig->getValue($key, serialize(null)); if ($value !== 'N;') { $configs[$key] = $value; } @@ -136,4 +140,25 @@ class ListConfigs extends Base { return $configs; } + + /** + * @param bool|array $keysToRemove + * @param mixed $value + * @return mixed + */ + protected function removeSensitiveValue($keysToRemove, $value) { + if ($keysToRemove === true) { + return self::SENSITIVE_VALUE; + } + + if (is_array($value)) { + foreach ($keysToRemove as $keyToRemove => $valueToRemove) { + if (isset($value[$keyToRemove])) { + $value[$keyToRemove] = $this->removeSensitiveValue($valueToRemove, $value[$keyToRemove]); + } + } + } + + return $value; + } } |