diff --git a/apps/user_ldap/lib/Command/CreateEmptyConfig.php b/apps/user_ldap/lib/Command/CreateEmptyConfig.php index 8b1736e3a535f..f7f04e28e607c 100644 --- a/apps/user_ldap/lib/Command/CreateEmptyConfig.php +++ b/apps/user_ldap/lib/Command/CreateEmptyConfig.php @@ -59,6 +59,7 @@ protected function configure() { protected function execute(InputInterface $input, OutputInterface $output): int { $configPrefix = $this->helper->getNextServerConfigurationPrefix(); $configHolder = new Configuration($configPrefix); + $configHolder->ldapConfigurationActive = false; $configHolder->saveConfiguration(); $prose = ''; diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php index ab5aa23f98d88..c895874a7a036 100644 --- a/apps/user_ldap/lib/Configuration.php +++ b/apps/user_ldap/lib/Configuration.php @@ -50,10 +50,9 @@ class Configuration { protected $configPrefix = null; protected $configRead = false; /** - * @var string[] pre-filled with one reference key so that at least one entry is written on save request and - * the config ID is registered + * @var string[] */ - protected $unsavedChanges = ['ldapConfigurationActive' => 'ldapConfigurationActive']; + protected $unsavedChanges = []; //settings protected $config = [ @@ -262,6 +261,7 @@ public function readConfiguration() { */ public function saveConfiguration() { $cta = array_flip($this->getConfigTranslationArray()); + $changed = false; foreach ($this->unsavedChanges as $key) { $value = $this->config[$key]; switch ($key) { @@ -291,9 +291,12 @@ public function saveConfiguration() { if (is_null($value)) { $value = ''; } + $changed = true; $this->saveValue($cta[$key], $value); } - $this->saveValue('_lastChange', time()); + if ($changed) { + $this->saveValue('_lastChange', (string)time()); + } $this->unsavedChanges = []; } diff --git a/apps/user_ldap/lib/Controller/ConfigAPIController.php b/apps/user_ldap/lib/Controller/ConfigAPIController.php index 72ded754880a7..e408d03fcd562 100644 --- a/apps/user_ldap/lib/Controller/ConfigAPIController.php +++ b/apps/user_ldap/lib/Controller/ConfigAPIController.php @@ -118,6 +118,7 @@ public function create() { try { $configPrefix = $this->ldapHelper->getNextServerConfigurationPrefix(); $configHolder = new Configuration($configPrefix); + $configHolder->ldapConfigurationActive = false; $configHolder->saveConfiguration(); } catch (\Exception $e) { $this->logger->logException($e);