general config: Don't keep unused configuration directives

This commit is contained in:
Eric Lippmann 2014-10-16 11:20:16 +02:00
parent 92b4f4fbec
commit f9e7e6d888
1 changed files with 7 additions and 4 deletions

View File

@ -40,13 +40,16 @@ class GeneralConfigForm extends ConfigForm
*/
public function onSuccess(Request $request)
{
$sections = array();
foreach ($this->getValues() as $sectionAndPropertyName => $value) {
list($section, $property) = explode('_', $sectionAndPropertyName);
if (isset($this->config->{$section})) {
$this->config->{$section}->{$property} = $value;
} else {
$this->config->{$section} = array($property => $value);
if (! isset($sections[$section])) {
$sections[$section] = array();
}
$sections[$section][$property] = $value;
}
foreach ($sections as $section => $config) {
$this->config->{$section} = $config;
}
if ($this->save()) {