fix: [diagnostics] allow for certain settings to be empty, fixes #176
- via the empty => true keypull/196/head
parent
cce4115418
commit
04b640c8b6
|
@ -163,18 +163,22 @@ class BaseSettingsProvider
|
|||
$setting['error'] = false;
|
||||
if (!$skipValidation) {
|
||||
$validationResult = true;
|
||||
if (!isset($setting['value'])) {
|
||||
$validationResult = $this->settingValidator->testEmptyBecomesDefault(null, $setting);
|
||||
} else if (isset($setting['test'])) {
|
||||
$setting['value'] = $setting['value'] ?? '';
|
||||
$validationResult = $this->evaluateFunctionForSetting($setting['test'], $setting);
|
||||
}
|
||||
if ($validationResult !== true) {
|
||||
$setting['severity'] = $setting['severity'] ?? 'warning';
|
||||
if (!in_array($setting['severity'], $this->severities)) {
|
||||
$setting['severity'] = 'warning';
|
||||
if (empty($setting['value']) && !empty($setting['empty'])) {
|
||||
$validationResult = true;
|
||||
} else {
|
||||
if (!isset($setting['value'])) {
|
||||
$validationResult = $this->settingValidator->testEmptyBecomesDefault(null, $setting);
|
||||
} else if (isset($setting['test'])) {
|
||||
$setting['value'] = $setting['value'] ?? '';
|
||||
$validationResult = $this->evaluateFunctionForSetting($setting['test'], $setting);
|
||||
}
|
||||
if ($validationResult !== true) {
|
||||
$setting['severity'] = $setting['severity'] ?? 'warning';
|
||||
if (!in_array($setting['severity'], $this->severities)) {
|
||||
$setting['severity'] = 'warning';
|
||||
}
|
||||
$setting['errorMessage'] = $validationResult;
|
||||
}
|
||||
$setting['errorMessage'] = $validationResult;
|
||||
}
|
||||
$setting['error'] = $validationResult !== true ? true : false;
|
||||
}
|
||||
|
|
|
@ -140,6 +140,7 @@ class CerebrateSettingsProvider extends BaseSettingsProvider
|
|||
'type' => 'string',
|
||||
'description' => __('The hostname of an HTTP proxy for outgoing sync requests. Leave empty to not use a proxy.'),
|
||||
'test' => 'testHostname',
|
||||
'empty' => true
|
||||
],
|
||||
'Proxy.port' => [
|
||||
'name' => __('Port'),
|
||||
|
@ -147,6 +148,7 @@ class CerebrateSettingsProvider extends BaseSettingsProvider
|
|||
'type' => 'integer',
|
||||
'description' => __('The TCP port for the HTTP proxy.'),
|
||||
'test' => 'testForRangeXY',
|
||||
'empty' => true
|
||||
],
|
||||
'Proxy.user' => [
|
||||
'name' => __('User'),
|
||||
|
@ -154,6 +156,7 @@ class CerebrateSettingsProvider extends BaseSettingsProvider
|
|||
'description' => __('The authentication username for the HTTP proxy.'),
|
||||
'default' => 'admin',
|
||||
'dependsOn' => 'proxy.host',
|
||||
'empty' => true
|
||||
],
|
||||
'Proxy.password' => [
|
||||
'name' => __('Password'),
|
||||
|
@ -161,6 +164,7 @@ class CerebrateSettingsProvider extends BaseSettingsProvider
|
|||
'description' => __('The authentication password for the HTTP proxy.'),
|
||||
'default' => '',
|
||||
'dependsOn' => 'proxy.host',
|
||||
'empty' => true
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue