summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-06-30 11:12:33 +0200
committerMorris Jobke <hey@morrisjobke.de>2017-10-27 14:25:19 +0200
commit4eab39f133392d37c171aa11f7e76896365f8454 (patch)
tree571e2b466470fc9325d79b77971371470647e4d2
parent4c1a5d6a88801ee6689208099cb45665925c27d9 (diff)
downloadnextcloud-server-4eab39f133392d37c171aa11f7e76896365f8454.tar.gz
nextcloud-server-4eab39f133392d37c171aa11f7e76896365f8454.zip
LDAP: only write actually changes values to the DB
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
-rw-r--r--apps/user_ldap/lib/Configuration.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php
index c65e6e34e2c..c0963037aaf 100644
--- a/apps/user_ldap/lib/Configuration.php
+++ b/apps/user_ldap/lib/Configuration.php
@@ -38,6 +38,8 @@ class Configuration {
protected $configPrefix = null;
protected $configRead = false;
+ /** @var string[] */
+ protected $unsavedChanges = [];
//settings
protected $config = array(
@@ -185,6 +187,8 @@ 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;
@@ -238,11 +242,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);
@@ -273,6 +278,7 @@ class Configuration {
}
$this->saveValue($cta[$key], $value);
}
+ $this->unsavedChanges = [];
}
/**