Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/lib/Configuration.php')
-rw-r--r--apps/user_ldap/lib/Configuration.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php
index bf8a9095a68..8522962172b 100644
--- a/apps/user_ldap/lib/Configuration.php
+++ b/apps/user_ldap/lib/Configuration.php
@@ -37,9 +37,13 @@ namespace OCA\User_LDAP;
* @property int ldapPagingSize holds an integer
*/
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
+ */
+ protected $unsavedChanges = ['ldapConfigurationActive' => 'ldapConfigurationActive'];
//settings
protected $config = array(
@@ -187,7 +191,9 @@ class Configuration {
$this->$setMethod($key, $val);
if(is_array($applied)) {
$applied[] = $inputKey;
+ // storing key as index avoids duplication, and as value for simplicity
}
+ $this->unsavedChanges[$key] = $key;
}
return null;
}
@@ -240,11 +246,12 @@ class Configuration {
}
/**
- * saves the current Configuration in the database
+ * saves the current config changes in the database
*/
public function saveConfiguration() {
$cta = array_flip($this->getConfigTranslationArray());
- foreach($this->config as $key => $value) {
+ foreach($this->unsavedChanges as $key) {
+ $value = $this->config[$key];
switch ($key) {
case 'ldapAgentPassword':
$value = base64_encode($value);
@@ -275,6 +282,8 @@ class Configuration {
}
$this->saveValue($cta[$key], $value);
}
+ $this->saveValue('_lastChange', time());
+ $this->unsavedChanges = [];
}
/**