diff --git a/application/controllers/HostController.php b/application/controllers/HostController.php index ef99f8c98..03f7ee8d5 100644 --- a/application/controllers/HostController.php +++ b/application/controllers/HostController.php @@ -8,6 +8,7 @@ use Icinga\Exception\NotFoundError; use Icinga\Module\Icingadb\Command\Object\GetObjectCommand; use Icinga\Module\Icingadb\Command\Transport\CommandTransport; +use Icinga\Module\Icingadb\Common\Backend; use Icinga\Module\Icingadb\Common\CommandActions; use Icinga\Module\Icingadb\Common\HostLinks; use Icinga\Module\Icingadb\Common\Links; @@ -434,13 +435,17 @@ protected function fetchNodes(bool $fetchParents = false): Query protected function createTabs(): Tabs { - $hasDependencyNode = DependencyNode::on($this->getDb()) - ->columns('1') - ->filter(Filter::all( - Filter::equal('host_id', $this->host->id), - Filter::unlike('service_id', '*') - )) - ->first() !== null; + if (Backend::getDbSchemaVersion() < 6) { + $hasDependencyNode = false; + } else { + $hasDependencyNode = DependencyNode::on($this->getDb()) + ->columns('1') + ->filter(Filter::all( + Filter::equal('host_id', $this->host->id), + Filter::unlike('service_id', '*') + )) + ->first() !== null; + } $tabs = $this->getTabs() ->add('index', [ diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 64aae9694..29c5e2572 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -406,13 +406,17 @@ protected function fetchNodes(bool $fetchParents = false): Query protected function createTabs(): Tabs { - $hasDependecyNode = DependencyNode::on($this->getDb()) - ->columns('1') - ->filter(Filter::all( - Filter::equal('service_id', $this->service->id), - Filter::equal('host_id', $this->service->host_id) - )) - ->first() !== null; + if (Backend::getDbSchemaVersion() < 6) { + $hasDependencyNode = false; + } else { + $hasDependencyNode = DependencyNode::on($this->getDb()) + ->columns('1') + ->filter(Filter::all( + Filter::equal('service_id', $this->service->id), + Filter::equal('host_id', $this->service->host_id) + )) + ->first() !== null; + } $tabs = $this->getTabs() ->add('index', [ @@ -424,7 +428,7 @@ protected function createTabs(): Tabs 'url' => ServiceLinks::history($this->service, $this->service->host) ]); - if ($hasDependecyNode) { + if ($hasDependencyNode) { $tabs->add('parents', [ 'label' => $this->translate('Parents'), 'url' => Url::fromPath(