Skip to content

Commit d4c558a

Browse files
authored
Merge pull request #31602 from nextcloud/fix/user_ldap-fix-last-change-updates
Do not update _lastChanged on auto-detected attributes
2 parents eea05b0 + 9fc00fd commit d4c558a

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

apps/user_ldap/lib/Command/CreateEmptyConfig.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ protected function configure() {
5959
protected function execute(InputInterface $input, OutputInterface $output): int {
6060
$configPrefix = $this->helper->getNextServerConfigurationPrefix();
6161
$configHolder = new Configuration($configPrefix);
62+
$configHolder->ldapConfigurationActive = false;
6263
$configHolder->saveConfiguration();
6364

6465
$prose = '';

apps/user_ldap/lib/Configuration.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ class Configuration {
5656
*/
5757
protected $configRead = false;
5858
/**
59-
* @var string[] pre-filled with one reference key so that at least one entry is written on save request and
60-
* the config ID is registered
59+
* @var string[]
6160
*/
62-
protected $unsavedChanges = ['ldapConfigurationActive' => 'ldapConfigurationActive'];
61+
protected array $unsavedChanges = [];
6362

6463
/**
6564
* @var array<string, mixed> settings
@@ -257,6 +256,7 @@ public function readConfiguration(): void {
257256
*/
258257
public function saveConfiguration(): void {
259258
$cta = array_flip($this->getConfigTranslationArray());
259+
$changed = false;
260260
foreach ($this->unsavedChanges as $key) {
261261
$value = $this->config[$key];
262262
switch ($key) {
@@ -286,9 +286,12 @@ public function saveConfiguration(): void {
286286
if (is_null($value)) {
287287
$value = '';
288288
}
289+
$changed = true;
289290
$this->saveValue($cta[$key], $value);
290291
}
291-
$this->saveValue('_lastChange', (string)time());
292+
if ($changed) {
293+
$this->saveValue('_lastChange', (string)time());
294+
}
292295
$this->unsavedChanges = [];
293296
}
294297

apps/user_ldap/lib/Controller/ConfigAPIController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public function create() {
118118
try {
119119
$configPrefix = $this->ldapHelper->getNextServerConfigurationPrefix();
120120
$configHolder = new Configuration($configPrefix);
121+
$configHolder->ldapConfigurationActive = false;
121122
$configHolder->saveConfiguration();
122123
} catch (\Exception $e) {
123124
$this->logger->logException($e);

0 commit comments

Comments
 (0)