Fix IniStore to save and load proper user preferences

This commit is contained in:
Alexander Fuhr 2014-11-12 13:16:09 +01:00
parent 533d2207fd
commit 4f84979c89
1 changed files with 8 additions and 4 deletions

View File

@ -67,7 +67,7 @@ class IniStore extends PreferencesStore
$this->getUser()->getUsername()
);
} else {
$this->preferences = parse_ini_file($this->preferencesFile);
$this->preferences = parse_ini_file($this->preferencesFile, true);
}
}
@ -81,9 +81,13 @@ class IniStore extends PreferencesStore
*/
public function save(Preferences $preferences)
{
$preferences = $preferences->toArray();
$this->update(array_diff_assoc($preferences, $this->preferences));
$this->delete(array_keys(array_diff_key($this->preferences, $preferences)));
$this->preferences = $preferences->toArray();
// TODO: Elaborate whether we need to patch the contents
// $preferences = $preferences->toArray();
// $this->update(array_diff_assoc($preferences, $this->preferences));
// $this->delete(array_keys(array_diff_key($this->preferences, $preferences)));
$this->write();
}