mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 15:54:03 +02:00
MonitoredObject: Deprecate method matches()
It's now possible to achieve the same by passing the object directly to a filter. refs #10304
This commit is contained in:
parent
65e7f7a8ca
commit
6a68d25bc3
@ -231,6 +231,8 @@ abstract class MonitoredObject implements Filterable
|
|||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
* @throws ProgrammingError In case the object cannot be found
|
* @throws ProgrammingError In case the object cannot be found
|
||||||
|
*
|
||||||
|
* @deprecated Use $filter->matches($object) instead
|
||||||
*/
|
*/
|
||||||
public function matches(Filter $filter)
|
public function matches(Filter $filter)
|
||||||
{
|
{
|
||||||
@ -242,38 +244,7 @@ abstract class MonitoredObject implements Filterable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$queryString = $filter->toQueryString();
|
return $filter->matches($this);
|
||||||
$row = clone $this->properties;
|
|
||||||
|
|
||||||
if (strpos($queryString, '_host_') !== false || strpos($queryString, '_service_') !== false) {
|
|
||||||
if ($this->customvars === null) {
|
|
||||||
$this->fetchCustomvars();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->customvars as $name => $value) {
|
|
||||||
if (! is_object($value)) {
|
|
||||||
$row->{'_' . $this->getType() . '_' . $name} = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strpos($queryString, 'hostgroup_name') !== false) {
|
|
||||||
if ($this->hostgroups === null) {
|
|
||||||
$this->fetchHostgroups();
|
|
||||||
}
|
|
||||||
|
|
||||||
$row->hostgroup_name = array_keys($this->hostgroups);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strpos($queryString, 'servicegroup_name') !== false) {
|
|
||||||
if ($this->servicegroups === null) {
|
|
||||||
$this->fetchServicegroups();
|
|
||||||
}
|
|
||||||
|
|
||||||
$row->servicegroup_name = array_keys($this->servicegroups);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $filter->matches($row);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,7 +101,7 @@ class Action extends NavigationItem
|
|||||||
{
|
{
|
||||||
if ($this->render === null) {
|
if ($this->render === null) {
|
||||||
$filter = $this->getFilter();
|
$filter = $this->getFilter();
|
||||||
$this->render = $filter ? $this->getObject()->matches(Filter::fromQueryString($filter)) : true;
|
$this->render = $filter ? Filter::fromQueryString($filter)->matches($this->getObject()) : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render;
|
return $this->render;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user