diff --git a/library/Icingadb/Hook/IcingadbSupportHook.php b/library/Icingadb/Hook/IcingadbSupportHook.php new file mode 100644 index 00000000..8de77a72 --- /dev/null +++ b/library/Icingadb/Hook/IcingadbSupportHook.php @@ -0,0 +1,52 @@ +getUser()->getPreferences()->get('icingaweb'); + if (! empty($webPreferences) && array_key_exists(static::PREFERENCE_NAME, $webPreferences)) { + return (bool) $webPreferences[static::PREFERENCE_NAME]; + } + + return false; + } + + /** + * Whether to use icingadb as the backend + * + * @return bool Returns true if monitoring module is disabled or icingadb is selected as backend, false otherwise. + */ + final public static function useIcingaDbAsBackend(): bool + { + return ! Icinga::app()->getModuleManager()->hasEnabled('monitoring') || self::isSetAsBackend(); + } +}