diff --git a/library/Director/Backend/MonitorBackend.php b/library/Director/Integration/BackendInterface.php similarity index 84% rename from library/Director/Backend/MonitorBackend.php rename to library/Director/Integration/BackendInterface.php index 5950d2c0..f8722c1b 100644 --- a/library/Director/Backend/MonitorBackend.php +++ b/library/Director/Integration/BackendInterface.php @@ -1,10 +1,10 @@ isAvailable() && $backend->canModifyHost($hostname)) { $allowEdit = IcingaHost::exists($hostname, $db); } diff --git a/library/Director/ProvidedHook/Icingadb/ServiceActions.php b/library/Director/ProvidedHook/Icingadb/ServiceActions.php index 383d915d..23f3fab9 100644 --- a/library/Director/ProvidedHook/Icingadb/ServiceActions.php +++ b/library/Director/ProvidedHook/Icingadb/ServiceActions.php @@ -4,8 +4,8 @@ namespace Icinga\Module\Director\ProvidedHook\Icingadb; use Exception; use Icinga\Application\Config; -use Icinga\Module\Director\Backend\MonitorBackendIcingadb; use Icinga\Module\Director\Db; +use Icinga\Module\Director\Integration\Icingadb\IcingadbBackend; use Icinga\Module\Director\Objects\IcingaHost; use Icinga\Module\Director\Util; use Icinga\Module\Icingadb\Hook\ServiceActionsHook; @@ -56,7 +56,7 @@ class ServiceActions extends ServiceActionsHook if (Util::hasPermission('director/hosts')) { $title = mt('director', 'Modify'); } elseif (Util::hasPermission('director/monitoring/services')) { - $backend = new MonitorBackendIcingadb(); + $backend = new IcingadbBackend(); if ($backend->isAvailable() && $backend->canModifyService($hostname, $serviceName) ) { diff --git a/library/Director/Web/Controller/ActionController.php b/library/Director/Web/Controller/ActionController.php index b1aadb96..72750b30 100644 --- a/library/Director/Web/Controller/ActionController.php +++ b/library/Director/Web/Controller/ActionController.php @@ -4,13 +4,12 @@ namespace Icinga\Module\Director\Web\Controller; use gipfl\Translation\StaticTranslator; use Icinga\Application\Benchmark; -use Icinga\Application\Icinga; use Icinga\Application\Modules\Module; use Icinga\Data\Paginatable; use Icinga\Exception\NotFoundError; use Icinga\Exception\ProgrammingError; -use Icinga\Module\Director\Backend\MonitorBackend; -use Icinga\Module\Director\Backend\MonitorBackendIcingadb; +use Icinga\Module\Director\Integration\Icingadb\IcingadbBackend; +use Icinga\Module\Director\Integration\BackendInterface; use Icinga\Module\Director\Integration\MonitoringModule\Monitoring; use Icinga\Module\Director\Web\Controller\Extension\CoreApi; use Icinga\Module\Director\Web\Controller\Extension\DirectorDb; @@ -40,7 +39,7 @@ abstract class ActionController extends Controller implements ControlsAndContent /** @var UrlParams Hint for IDE, somehow does not work in web */ protected $params; - /** @var MonitorBackend */ + /** @var BackendInterface */ private $backend; /** @@ -244,13 +243,13 @@ abstract class ActionController extends Controller implements ControlsAndContent } /** - * @return MonitorBackend + * @return BackendInterface */ - protected function backend() + protected function backend(): BackendInterface { if ($this->backend === null) { if (Module::exists('icingadb')) { - $this->backend = new MonitorBackendIcingadb(); + $this->backend = new IcingadbBackend(); } else { $this->backend = new Monitoring($this->Auth()); }