Skip to content

Commit

Permalink
Show/hide correct database fields on initial load
Browse files Browse the repository at this point in the history
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
  • Loading branch information
benbz committed Sep 24, 2020
1 parent e85c062 commit 4900196
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Core/Frameworks/BaikalAdmin/Controller/Install/Database.php
Original file line number Diff line number Diff line change
@@ -215,12 +215,8 @@ function hideMySQLFieldWhenNeeded(\Formal\Form $oForm, \Formal\Form\Morphology $
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) {

0 comments on commit 4900196

Please sign in to comment.