DbResourceForm: make code a bit less redundand

refs #11115
This commit is contained in:
Alexander A. Klimov 2016-12-08 17:30:16 +01:00
parent 2e1c1da927
commit eafb066024
1 changed files with 7 additions and 18 deletions

View File

@ -46,24 +46,13 @@ class DbResourceForm extends Form
$encryptionChoices = array();
$offerPostgres = false;
$offerMysql = false;
if (isset($formData['db'])) {
if ($formData['db'] === 'pgsql') {
$offerPostgres = true;
} elseif ($formData['db'] === 'mysql') {
$offerMysql = true;
if (version_compare(Platform::getPhpVersion(), '5.4.0', '>=')) {
$encryptionChoices['ssl'] = 'SSL';
}
}
} else {
$dbChoice = key($dbChoices);
if ($dbChoice === 'pgsql') {
$offerPostgres = true;
} elseif ($dbChoice === 'mysql') {
$offerMysql = true;
if (version_compare(Platform::getPhpVersion(), '5.4.0', '>=')) {
$encryptionChoices['ssl'] = 'SSL';
}
$dbChoice = isset($formData['db']) ? $formData['db'] : key($dbChoices);
if ($dbChoice === 'pgsql') {
$offerPostgres = true;
} elseif ($dbChoice === 'mysql') {
$offerMysql = true;
if (version_compare(Platform::getPhpVersion(), '5.4.0', '>=')) {
$encryptionChoices['ssl'] = 'SSL';
}
}