From fcfeac6c3aa3f7fecb90ba74e70212c5b9911c74 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 2 Nov 2021 13:34:40 +0100 Subject: [PATCH] Merge pull request #4579 from Icinga/fix/config-and-preferences-not-working-without-config-4504 Fix config and preferences not working without config (cherry picked from commit 5756ebba1fd873d187f59471ca65ec86a52b68cb) --- application/controllers/AccountController.php | 2 +- application/forms/Config/GeneralConfigForm.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/controllers/AccountController.php b/application/controllers/AccountController.php index 9f247dcd3..4dc655452 100644 --- a/application/controllers/AccountController.php +++ b/application/controllers/AccountController.php @@ -69,7 +69,7 @@ class AccountController extends Controller $form = new PreferenceForm(); $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( 'store' => $config->get('config_backend', 'db'), 'resource' => $config->config_resource diff --git a/application/forms/Config/GeneralConfigForm.php b/application/forms/Config/GeneralConfigForm.php index 57c1a4cbc..18d379094 100644 --- a/application/forms/Config/GeneralConfigForm.php +++ b/application/forms/Config/GeneralConfigForm.php @@ -42,7 +42,7 @@ class GeneralConfigForm extends ConfigForm { 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'); } }