icingaweb2-module-businessp.../application/controllers/HostController.php
Ravi Kumar Kempapura Srinivasa efcea15ab6 Clean the scripts and resolve the comments
Clean the scripts to pass the phpcodesniffer tests and resolve the comments provided by Eric.
2022-02-03 16:54:01 +01:00

47 lines
1.5 KiB
PHP

<?php
namespace Icinga\Module\Businessprocess\Controllers;
use Icinga\Module\Businessprocess\Common\IcingadbDatabase;
//use Icinga\Module\Businessprocess\Web\Controller;
use Icinga\Module\Businessprocess\IcingaDbBackend;
use Icinga\Module\Icingadb\Model\Host;
use Icinga\Module\Monitoring\Backend;
use Icinga\Module\Monitoring\Controller;
use Icinga\Web\Url;
class HostController extends Controller
{
use IcingadbDatabase;
public function showAction()
{
$hostName = $this->params->get('host');
$icingadb = $this->params->get('icingadb');
if ($icingadb) {
$host = Host::on($this->getDb());
$host->getSelectBase()
->where(['host.name = ?' => $hostName]);
IcingaDbBackend::applyMonitoringRestriction($host);
$rs = $host->columns('host.name')->first();
$this->params->add('name', $hostName);
if ($rs !== false) {
$this->redirectNow(Url::fromPath('icingadb/host')->setParams($this->params));
}
} else {
$query = $this->backend->select()
->from('hoststatus', array('host_name'))
->where('host_name', $hostName);
if ($this->applyRestriction('monitoring/filter/objects', $query)->fetchRow() !== false) {
$this->redirectNow(Url::fromPath('monitoring/host/show')->setParams($this->params));
}
}
$this->view->host = $hostName;
}
}