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>
This commit is contained in:
Côme Chilliet 2022-03-22 14:53:37 +01:00 committed by backportbot[bot]
parent 6e1ac0a9bb
commit a8ebd9909c
3 changed files with 4 additions and 3 deletions

View file

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

View file

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

View file

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