MonitoredObject: Ensure that the filter is applied to all queries

refs #9009
This commit is contained in:
Johannes Meyer 2015-06-16 17:44:29 +02:00
parent d0a7c481c2
commit 670d6e93c7
2 changed files with 9 additions and 9 deletions

View File

@ -151,8 +151,8 @@ class Host extends MonitoredObject
$services = array();
foreach ($this->backend->select()->from('servicestatus', array('service_description'))
->where('host_name', $this->host)
->getQuery()
->fetchAll() as $service) {
->applyFilter($this->getFilter())
->getQuery() as $service) {
$services[] = new Service($this->backend, $this->host, $service->service_description);
}
$this->services = $services;

View File

@ -155,7 +155,7 @@ abstract class MonitoredObject implements Filterable
public function getFilter()
{
if ($this->filter === null) {
$this->filter = Filter::matchAny();
$this->filter = Filter::matchAll();
}
return $this->filter;
}
@ -261,7 +261,7 @@ abstract class MonitoredObject implements Filterable
} else {
$comments->where('host_name', $this->host_name);
}
$this->comments = $comments->getQuery()->fetchAll();
$this->comments = $comments->applyFilter($this->getFilter())->getQuery()->fetchAll();
return $this;
}
@ -297,7 +297,7 @@ abstract class MonitoredObject implements Filterable
$downtimes
->where('host_name', $this->host_name);
}
$this->downtimes = $downtimes->getQuery()->fetchAll();
$this->downtimes = $downtimes->applyFilter($this->getFilter())->getQuery()->fetchAll();
return $this;
}
@ -311,7 +311,7 @@ abstract class MonitoredObject implements Filterable
$this->hostgroups = $this->backend->select()
->from('hostgroup', array('hostgroup_name', 'hostgroup_alias'))
->where('host_name', $this->host_name)
->applyFilter($this->filter)
->applyFilter($this->getFilter())
->fetchPairs();
return $this;
}
@ -395,7 +395,7 @@ abstract class MonitoredObject implements Filterable
} else {
$contacts->where('host_name', $this->host_name);
}
$this->contacts = $contacts->getQuery()->fetchAll();
$this->contacts = $contacts->applyFilter($this->getFilter())->getQuery()->fetchAll();
return $this;
}
@ -438,7 +438,7 @@ abstract class MonitoredObject implements Filterable
} else {
$contactsGroups->where('host_name', $this->host_name);
}
$this->contactgroups = $contactsGroups->getQuery()->fetchAll();
$this->contactgroups = $contactsGroups->applyFilter($this->getFilter())->getQuery()->fetchAll();
return $this;
}
@ -464,7 +464,7 @@ abstract class MonitoredObject implements Filterable
if ($this->type === self::TYPE_SERVICE) {
$eventHistory->where('service_description', $this->service_description);
}
$this->eventhistory = $eventHistory;
$this->eventhistory = $eventHistory->applyFilter($this->getFilter());
return $this;
}