Merge pull request #4579 from Icinga/fix/config-and-preferences-not-working-without-config-4504

Fix config and preferences not working without config
This commit is contained in:
Johannes Meyer 2021-11-02 13:34:40 +01:00 committed by GitHub
commit 5756ebba1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -69,7 +69,7 @@ class AccountController extends Controller
$form = new PreferenceForm(); $form = new PreferenceForm();
$form->setPreferences($user->getPreferences()); $form->setPreferences($user->getPreferences());
if ($config->get('config_backend', 'db') !== 'none') { if ($config->get('config_backend', 'db') !== 'none' && isset($config->config_resource)) {
$form->setStore(PreferencesStore::create(new ConfigObject(array( $form->setStore(PreferencesStore::create(new ConfigObject(array(
'store' => $config->get('config_backend', 'db'), 'store' => $config->get('config_backend', 'db'),
'resource' => $config->config_resource 'resource' => $config->config_resource

View File

@ -42,7 +42,7 @@ class GeneralConfigForm extends ConfigForm
{ {
parent::onRequest(); parent::onRequest();
if ($this->config->getConfigObject()->global->config_backend === 'ini') { if ($this->config->get('global', 'config_backend') === 'ini') {
$this->warning('The preferences backend of type INI is deprecated and will be removed with version 2.11'); $this->warning('The preferences backend of type INI is deprecated and will be removed with version 2.11');
} }
} }