Show/hide correct database fields on initial load

On the initial load the form morphology hook is called prior to the
morphology being populated with values from the model. Loading from the
YAML won't always work if we're coming from < 0.7.0.

Loading from the model is safe as:
- The model is initially populated with the YAML
- If legacy config is present then the model is updated with that
- If this isn't the initial load we go down the submitted branch instead
This commit is contained in:
Ben Banfield-Zanin 2020-09-24 21:45:57 +01:00
parent e85c0626c1
commit 4900196f4c

View file

@ -215,12 +215,8 @@ class Database extends \Flake\Core\Controller {
if ($oForm->submitted()) {
$bMySQL = (intval($oForm->postValue("mysql")) === 1);
} else {
try {
$configSystem = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml");
} catch (\Exception $e) {
error_log('Error reading baikal.yaml file : ' . $e->getMessage());
}
$bMySQL = $configSystem['database']['mysql'] ?? true;
// oMorpho won't have the values from the model set on it yet
$bMySQL = $this->oModel->get("mysql");
}
if ($bMySQL === true) {