Avoid updating _lastChange when nothing is changed in the configuration

Had to set at least one var when creating an empty configuration in
 order to save the default values.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/31602/head
Côme Chilliet 2022-03-22 14:53:37 +07:00 committed by Côme Chilliet (Rebase PR Action)
parent bd9c4fbc07
commit 9fc00fdb82
3 changed files with 4 additions and 3 deletions

@ -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 = '';

@ -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

@ -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);