Preferences: Fix error messages and convenience configuration
refs #4648
This commit is contained in:
parent
772d27bb89
commit
7be7335bdd
|
@ -1 +0,0 @@
|
|||
# Keep this directory
|
|
@ -249,6 +249,15 @@ class Web extends ApplicationBootstrap
|
|||
$preferences->attach($sessionStore);
|
||||
|
||||
if ($this->getConfig()->preferences !== null) {
|
||||
if (!$this->getConfig()->preferences->type) {
|
||||
Logger::info(
|
||||
'Preferences provider configuration error. No type was omitted. For convenience we enable '
|
||||
. 'file based ini provider for you.'
|
||||
);
|
||||
|
||||
$this->getConfig()->preferences->type = 'ini';
|
||||
}
|
||||
|
||||
$path = Config::resolvePath($this->getConfig()->preferences->configPath);
|
||||
if (is_dir($path) === false) {
|
||||
Logger::error(
|
||||
|
|
|
@ -28,11 +28,12 @@
|
|||
|
||||
namespace Icinga\User\Preferences;
|
||||
|
||||
use Icinga\User;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
use \Icinga\Application\DbAdapterFactory;
|
||||
use \Zend_Config;
|
||||
use \Zend_Db;
|
||||
use \Icinga\User;
|
||||
use \Icinga\Exception\ProgrammingError;
|
||||
use \Icinga\Application\DbAdapterFactory;
|
||||
use Icinga\Application\Logger;
|
||||
|
||||
/**
|
||||
* Create preference stores from zend config
|
||||
|
@ -66,7 +67,10 @@ final class StoreFactory
|
|||
$store = new $class();
|
||||
|
||||
if (!$store instanceof FlushObserverInterface) {
|
||||
throw new ProgrammingError('Not instance of FlushObserverInterface: '. $class);
|
||||
throw new ProgrammingError(
|
||||
'Preferences StoreFactory could not create provider (class ' . $class . '). '
|
||||
. 'Class is not instance of FlushObserverInterface.'
|
||||
);
|
||||
}
|
||||
|
||||
$items = $config->toArray();
|
||||
|
@ -88,6 +92,8 @@ final class StoreFactory
|
|||
return $store;
|
||||
}
|
||||
|
||||
throw new ProgrammingError('Could not instantiate class: '. $class);
|
||||
throw new ProgrammingError(
|
||||
'Preferences StoreFactory could not create provider (class ' . $class . '). Class not found.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue