mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-22 13:24:24 +02:00
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\Web\Widget\Tab;
|
||||||
use Icinga\Application\Config;
|
use Icinga\Application\Config;
|
||||||
use Icinga\Forms\PreferenceForm;
|
use Icinga\Forms\PreferenceForm;
|
||||||
use Icinga\Exception\ConfigurationError;
|
|
||||||
use Icinga\User\Preferences\PreferencesStore;
|
use Icinga\User\Preferences\PreferencesStore;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,9 +39,6 @@ class PreferenceController extends BasePreferenceController
|
|||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
$storeConfig = Config::app()->getSection('preferences');
|
$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();
|
$user = $this->getRequest()->getUser();
|
||||||
$form = new PreferenceForm();
|
$form = new PreferenceForm();
|
||||||
|
@ -63,7 +63,7 @@ class Manager
|
|||||||
);
|
);
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
}
|
}
|
||||||
if ($config->hasSection('preferences')) {
|
if ($config->get('preferences', 'store', 'ini') !== 'none') {
|
||||||
$preferencesConfig = $config->getSection('preferences');
|
$preferencesConfig = $config->getSection('preferences');
|
||||||
try {
|
try {
|
||||||
$preferencesStore = PreferencesStore::create(
|
$preferencesStore = PreferencesStore::create(
|
||||||
|
@ -117,13 +117,7 @@ abstract class PreferencesStore
|
|||||||
*/
|
*/
|
||||||
public static function create(ConfigObject $config, User $user)
|
public static function create(ConfigObject $config, User $user)
|
||||||
{
|
{
|
||||||
if (($type = $config->store) === null) {
|
$type = ucfirst(strtolower($config->get('store', 'ini')));
|
||||||
throw new ConfigurationError(
|
|
||||||
'Preferences configuration is missing the store directive'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$type = ucfirst(strtolower($type));
|
|
||||||
$storeClass = 'Icinga\\User\\Preferences\\Store\\' . $type . 'Store';
|
$storeClass = 'Icinga\\User\\Preferences\\Store\\' . $type . 'Store';
|
||||||
if (!class_exists($storeClass)) {
|
if (!class_exists($storeClass)) {
|
||||||
throw new ConfigurationError(
|
throw new ConfigurationError(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user