2017-12-04 12:05:07 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Icinga\Module\Businessprocess\Controllers;
|
|
|
|
|
|
2021-11-17 10:22:22 -05:00
|
|
|
use Icinga\Module\Businessprocess\IcingaDbObject;
|
2020-04-27 19:08:24 -04:00
|
|
|
use Icinga\Module\Icingadb\Model\Host;
|
2017-12-04 12:05:07 -05:00
|
|
|
use Icinga\Web\Url;
|
2022-02-10 10:25:12 -05:00
|
|
|
use ipl\Stdlib\Filter;
|
2026-01-07 05:31:37 -05:00
|
|
|
use ipl\Web\Compat\CompatController;
|
2017-12-04 12:05:07 -05:00
|
|
|
|
2026-01-07 05:31:37 -05:00
|
|
|
class HostController extends CompatController
|
2017-12-04 12:05:07 -05:00
|
|
|
{
|
2026-01-07 05:31:37 -05:00
|
|
|
public function showAction(): void
|
2022-02-10 10:25:12 -05:00
|
|
|
{
|
2026-01-07 05:31:37 -05:00
|
|
|
$hostName = $this->params->shift('host');
|
2017-12-04 12:05:07 -05:00
|
|
|
|
2026-01-07 05:31:37 -05:00
|
|
|
$query = Host::on(IcingaDbObject::fetchDb());
|
|
|
|
|
IcingaDbObject::applyIcingaDbRestrictions($query);
|
2020-04-27 19:08:24 -04:00
|
|
|
|
2026-01-07 05:31:37 -05:00
|
|
|
$query->filter(Filter::equal('host.name', $hostName));
|
2020-04-27 19:08:24 -04:00
|
|
|
|
2026-01-07 05:31:37 -05:00
|
|
|
$host = $query->first();
|
2020-05-12 17:20:01 -04:00
|
|
|
|
2026-01-07 05:31:37 -05:00
|
|
|
$this->params->add('name', $hostName);
|
2017-12-04 12:05:07 -05:00
|
|
|
|
2026-01-07 05:31:37 -05:00
|
|
|
if ($host !== null) {
|
|
|
|
|
$this->redirectNow(Url::fromPath('icingadb/host')->setParams($this->params));
|
2017-12-04 12:05:07 -05:00
|
|
|
}
|
|
|
|
|
|
2020-04-30 09:55:49 -04:00
|
|
|
$this->view->host = $hostName;
|
2017-12-04 12:05:07 -05:00
|
|
|
}
|
|
|
|
|
}
|