LDAP: only write actually changes values to the DB
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
4c1a5d6a88
commit
4eab39f133
|
@ -38,6 +38,8 @@ class Configuration {
|
||||||
|
|
||||||
protected $configPrefix = null;
|
protected $configPrefix = null;
|
||||||
protected $configRead = false;
|
protected $configRead = false;
|
||||||
|
/** @var string[] */
|
||||||
|
protected $unsavedChanges = [];
|
||||||
|
|
||||||
//settings
|
//settings
|
||||||
protected $config = array(
|
protected $config = array(
|
||||||
|
@ -185,6 +187,8 @@ class Configuration {
|
||||||
$this->$setMethod($key, $val);
|
$this->$setMethod($key, $val);
|
||||||
if(is_array($applied)) {
|
if(is_array($applied)) {
|
||||||
$applied[] = $inputKey;
|
$applied[] = $inputKey;
|
||||||
|
// storing key as index avoids duplication, and as value for simplicity
|
||||||
|
$this->unsavedChanges[$key] = $key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
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() {
|
public function saveConfiguration() {
|
||||||
$cta = array_flip($this->getConfigTranslationArray());
|
$cta = array_flip($this->getConfigTranslationArray());
|
||||||
foreach($this->config as $key => $value) {
|
foreach($this->unsavedChanges as $key) {
|
||||||
|
$value = $this->config[$key];
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
case 'ldapAgentPassword':
|
case 'ldapAgentPassword':
|
||||||
$value = base64_encode($value);
|
$value = base64_encode($value);
|
||||||
|
@ -273,6 +278,7 @@ class Configuration {
|
||||||
}
|
}
|
||||||
$this->saveValue($cta[$key], $value);
|
$this->saveValue($cta[$key], $value);
|
||||||
}
|
}
|
||||||
|
$this->unsavedChanges = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue