Use "ini" as preferences store in case preferences are not configured
refs #8234
This commit is contained in:
parent
359336243c
commit
d452f3218d
|
@ -7,7 +7,6 @@ use Icinga\Web\Url;
|
|||
use Icinga\Web\Widget\Tab;
|
||||
use Icinga\Application\Config;
|
||||
use Icinga\Forms\PreferenceForm;
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\User\Preferences\PreferencesStore;
|
||||
|
||||
/**
|
||||
|
@ -40,9 +39,6 @@ class PreferenceController extends BasePreferenceController
|
|||
public function indexAction()
|
||||
{
|
||||
$storeConfig = Config::app()->getSection('preferences');
|
||||
if ($storeConfig->isEmpty()) {
|
||||
throw new ConfigurationError(t('You need to configure how to store preferences first.'));
|
||||
}
|
||||
|
||||
$user = $this->getRequest()->getUser();
|
||||
$form = new PreferenceForm();
|
||||
|
|
|
@ -63,7 +63,7 @@ class Manager
|
|||
);
|
||||
$config = new Config();
|
||||
}
|
||||
if ($config->hasSection('preferences')) {
|
||||
if ($config->get('preferences', 'store', 'ini') !== 'none') {
|
||||
$preferencesConfig = $config->getSection('preferences');
|
||||
try {
|
||||
$preferencesStore = PreferencesStore::create(
|
||||
|
|
|
@ -117,13 +117,7 @@ abstract class PreferencesStore
|
|||
*/
|
||||
public static function create(ConfigObject $config, User $user)
|
||||
{
|
||||
if (($type = $config->store) === null) {
|
||||
throw new ConfigurationError(
|
||||
'Preferences configuration is missing the store directive'
|
||||
);
|
||||
}
|
||||
|
||||
$type = ucfirst(strtolower($type));
|
||||
$type = ucfirst(strtolower($config->get('store', 'ini')));
|
||||
$storeClass = 'Icinga\\User\\Preferences\\Store\\' . $type . 'Store';
|
||||
if (!class_exists($storeClass)) {
|
||||
throw new ConfigurationError(
|
||||
|
|
Loading…
Reference in New Issue