summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-03-31 14:07:16 +0200
committerGitHub <noreply@github.com>2022-03-31 14:07:16 +0200
commitd4c558a229080670ad9fc5ba8083a648b2ab74ac (patch)
treed83094cbfcba1cf77a5c521e71b65f2af702cee0 /apps
parenteea05b05edb229a5834df43983ab6bd97de63e8e (diff)
parent9fc00fdb8289a0e1b65be39a5afa7d5ea8513e74 (diff)
downloadnextcloud-server-d4c558a229080670ad9fc5ba8083a648b2ab74ac.tar.gz
nextcloud-server-d4c558a229080670ad9fc5ba8083a648b2ab74ac.zip
Merge pull request #31602 from nextcloud/fix/user_ldap-fix-last-change-updates
Do not update _lastChanged on auto-detected attributes
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/lib/Command/CreateEmptyConfig.php1
-rw-r--r--apps/user_ldap/lib/Configuration.php11
-rw-r--r--apps/user_ldap/lib/Controller/ConfigAPIController.php1
3 files changed, 9 insertions, 4 deletions
diff --git a/apps/user_ldap/lib/Command/CreateEmptyConfig.php b/apps/user_ldap/lib/Command/CreateEmptyConfig.php
index 8b1736e3a53..f7f04e28e60 100644
--- a/apps/user_ldap/lib/Command/CreateEmptyConfig.php
+++ b/apps/user_ldap/lib/Command/CreateEmptyConfig.php
@@ -59,6 +59,7 @@ class CreateEmptyConfig extends Command {
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 9ffb2a79781..c16823d39ee 100644
--- a/apps/user_ldap/lib/Configuration.php
+++ b/apps/user_ldap/lib/Configuration.php
@@ -56,10 +56,9 @@ class Configuration {
*/
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 array $unsavedChanges = [];
/**
* @var array<string, mixed> settings
@@ -257,6 +256,7 @@ class Configuration {
*/
public function saveConfiguration(): void {
$cta = array_flip($this->getConfigTranslationArray());
+ $changed = false;
foreach ($this->unsavedChanges as $key) {
$value = $this->config[$key];
switch ($key) {
@@ -286,9 +286,12 @@ class Configuration {
if (is_null($value)) {
$value = '';
}
+ $changed = true;
$this->saveValue($cta[$key], $value);
}
- $this->saveValue('_lastChange', (string)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 72ded754880..e408d03fcd5 100644
--- a/apps/user_ldap/lib/Controller/ConfigAPIController.php
+++ b/apps/user_ldap/lib/Controller/ConfigAPIController.php
@@ -118,6 +118,7 @@ class ConfigAPIController extends OCSController {
try {
$configPrefix = $this->ldapHelper->getNextServerConfigurationPrefix();
$configHolder = new Configuration($configPrefix);
+ $configHolder->ldapConfigurationActive = false;
$configHolder->saveConfiguration();
} catch (\Exception $e) {
$this->logger->logException($e);