mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
Load resources from config automatically instead of throwing an exception
fixes #10918
This commit is contained in:
parent
9d5e21e71e
commit
e4a0678df0
@ -520,25 +520,6 @@ abstract class ApplicationBootstrap
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set up the resource factory
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
protected function setupResourceFactory()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$config = Config::app('resources');
|
|
||||||
ResourceFactory::setConfig($config);
|
|
||||||
} catch (NotReadableError $e) {
|
|
||||||
Logger::error(
|
|
||||||
new IcingaException('Cannot load resource configuration. An exception was thrown:', $e)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up the user backend factory
|
* Set up the user backend factory
|
||||||
*
|
*
|
||||||
|
@ -41,7 +41,6 @@ class Cli extends ApplicationBootstrap
|
|||||||
->setupInternationalization()
|
->setupInternationalization()
|
||||||
->parseBasicParams()
|
->parseBasicParams()
|
||||||
->setupLogger()
|
->setupLogger()
|
||||||
->setupResourceFactory()
|
|
||||||
->setupModuleManager()
|
->setupModuleManager()
|
||||||
->setupUserBackendFactory()
|
->setupUserBackendFactory()
|
||||||
->loadSetupModuleIfNecessary();
|
->loadSetupModuleIfNecessary();
|
||||||
|
@ -82,7 +82,6 @@ class Web extends EmbeddedWeb
|
|||||||
->setupLogging()
|
->setupLogging()
|
||||||
->setupErrorHandling()
|
->setupErrorHandling()
|
||||||
->loadConfig()
|
->loadConfig()
|
||||||
->setupResourceFactory()
|
|
||||||
->setupSession()
|
->setupSession()
|
||||||
->setupNotifications()
|
->setupNotifications()
|
||||||
->setupRequest()
|
->setupRequest()
|
||||||
|
@ -67,16 +67,14 @@ class ResourceFactory implements ConfigAwareFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the existing resources are set. If not, throw an error.
|
* Check if the existing resources are set. If not, load them from resources.ini
|
||||||
*
|
*
|
||||||
* @throws ConfigurationError
|
* @throws ConfigurationError
|
||||||
*/
|
*/
|
||||||
private static function assertResourcesExist()
|
private static function assertResourcesExist()
|
||||||
{
|
{
|
||||||
if (self::$resources === null) {
|
if (self::$resources === null) {
|
||||||
throw new ConfigurationError(
|
self::$resources = Config::app('resources');
|
||||||
'Resources not set up. Please contact your Icinga Web administrator'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user