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

View File

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