From fdf74c5e18103041c55ec86ed818478b07447210 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 25 Jun 2014 11:05:23 +0200 Subject: [PATCH] Revert "Make preferences INI path NOT be configurable" This reverts commit 219869607dab6b9fe9d7eec5a9ae82af5dfa23e9. --- application/forms/Config/GeneralForm.php | 17 ++++++++++++++++- .../Icinga/Application/ApplicationBootstrap.php | 4 +++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/application/forms/Config/GeneralForm.php b/application/forms/Config/GeneralForm.php index 1ff21bfd1..8feee3dab 100644 --- a/application/forms/Config/GeneralForm.php +++ b/application/forms/Config/GeneralForm.php @@ -212,6 +212,16 @@ class GeneralForm extends Form ) ); + $txtPreferencesIniPath = new Zend_Form_Element_Text( + array( + 'name' => 'preferences_ini_path', + 'label' => 'User Preference Filepath', + 'required' => $backend === 'ini', + 'condition' => $backend === 'ini', + 'value' => $cfg->get('config_path') + ) + ); + $backends = array(); foreach ($this->getResources() as $name => $resource) { if ($resource['type'] !== 'db') { @@ -232,8 +242,11 @@ class GeneralForm extends Form ); $validator = new WritablePathValidator(); $validator->setRequireExistence(); + $txtPreferencesIniPath->addValidator($validator); + $this->addElement($txtPreferencesIniPath); $this->addElement($txtPreferencesDbResource); + $txtPreferencesIniPath->addDecorator(new ConditionalHidden()); $txtPreferencesDbResource->addDecorator(new ConditionalHidden()); $this->enableAutoSubmit( array( @@ -288,7 +301,9 @@ class GeneralForm extends Form $cfg->global->timezone = $values['timezone']; $cfg->global->modulePath = $values['module_path']; $cfg->preferences->type = $values['preferences_type']; - if ($cfg->preferences->type === 'db') { + if ($cfg->preferences->type === 'ini') { + $cfg->preferences->config_path = $values['preferences_ini_path']; + } elseif ($cfg->preferences->type === 'db') { $cfg->preferences->resource = $values['preferences_db_resource']; } diff --git a/library/Icinga/Application/ApplicationBootstrap.php b/library/Icinga/Application/ApplicationBootstrap.php index bb530ce29..89597be3d 100644 --- a/library/Icinga/Application/ApplicationBootstrap.php +++ b/library/Icinga/Application/ApplicationBootstrap.php @@ -152,7 +152,9 @@ abstract class ApplicationBootstrap } } $canonical = realpath($configDir); - $this->configDir = $canonical ? $canonical : $configDir; + if ($canonical) { + $this->configDir = $canonical; + } $this->setupAutoloader(); $this->setupZendAutoloader();