Fix that when chosing to not to store preferences an invalid config is created

fixes #8234
This commit is contained in:
Johannes Meyer 2015-01-23 14:41:14 +01:00
parent c78d4aa0bd
commit 6284da451e
3 changed files with 6 additions and 7 deletions

View File

@ -48,13 +48,13 @@ class ApplicationConfigForm extends Form
'select',
'preferences_type',
array(
'required' => true,
'allowEmpty' => true,
'autosubmit' => true,
'label' => $this->translate('User Preference Storage Type'),
'multiOptions' => array(
'ini' => $this->translate('File System (INI Files)'),
'db' => $this->translate('Database'),
'null' => $this->translate('Don\'t Store Preferences')
'' => $this->translate('Don\'t Store Preferences')
)
)
);

View File

@ -63,11 +63,10 @@ class Manager
);
$config = new Config();
}
if ($config->hasSection('preferences')) {
$preferencesConfig = $config->getSection('preferences');
if ($config->get('preferences', 'type')) {
try {
$preferencesStore = PreferencesStore::create(
$preferencesConfig,
$config->getSection('preferences'),
$user
);
$preferences = new Preferences($preferencesStore->load());

View File

@ -66,13 +66,13 @@ class PreferencesPage extends Form
if (Platform::hasMysqlSupport() || Platform::hasPostgresqlSupport()) {
$storageTypes['db'] = $this->translate('Database');
}
$storageTypes['null'] = $this->translate('Don\'t Store Preferences');
$storageTypes[''] = $this->translate('Don\'t Store Preferences');
$this->addElement(
'select',
'type',
array(
'required' => true,
'allowEmpty' => true,
'label' => $this->translate('User Preference Storage Type'),
'multiOptions' => $storageTypes
)