File tree Expand file tree Collapse file tree 3 files changed +21
-12
lines changed
Expand file tree Collapse file tree 3 files changed +21
-12
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,11 @@ class Servicestatus extends IcingaServiceStatus
1515 * @param array|null $columns
1616 * @noinspection PhpMissingParentConstructorInspection
1717 */
18- public function __construct (ConnectionInterface $ connection , array $ columns = null )
18+ public function __construct (ConnectionInterface $ connection , array $ columns = null , $ options = null )
1919 {
2020 /** @var MonitoringBackend $connection */
2121 $ this ->connection = $ connection ;
22- $ this ->query = new ServicestatusQuery ($ connection ->getResource (), $ columns );
22+ $ this ->query = new ServicestatusQuery ($ connection ->getResource (), $ columns, $ options );
2323 }
2424
2525 /**
Original file line number Diff line number Diff line change 1010 */
1111class ServicestatusQuery extends IcingaServicestatusQuery
1212{
13- // TODO: not used in this query
14- //use IgnoredNotificationPeriods;
15- //use Options;
13+ use IgnoredNotificationPeriods;
14+ use Options;
15+
16+ public function __construct ($ ds , $ columns = null , $ options = null )
17+ {
18+ $ this ->setOptions ($ options );
19+ parent ::__construct ($ ds , $ columns );
20+ }
1621
1722 public function init ()
1823 {
19- /* TODO: not used in this query
2024 if (($ periods = $ this ->getOption ('ignored_notification_periods ' )) !== null ) {
2125 $ this ->ignoreNotificationPeriods ($ periods );
2226 }
23- */
2427
2528 $ patchedColumnMap = array (
2629 'servicestatus ' => array (
@@ -52,11 +55,12 @@ protected function joinServicenotificationperiod()
5255 {
5356 $ extraJoinCond = '' ;
5457
55- /* TODO: not used in this query
56- if (! empty ($this->ignoredNotificationPeriods)) {
57- $extraJoinCond .= $this->db->quoteInto(' AND ntpo.name1 NOT IN (?)', $this->ignoredNotificationPeriods);
58+ if ($ this ->hasIgnoredNotifications ()) {
59+ $ extraJoinCond .= $ this ->db ->quoteInto (
60+ ' AND ntpo.name1 NOT IN (?) ' ,
61+ $ this ->getIgnoredNotificationPeriods ()
62+ );
5863 }
59- */
6064
6165 $ this ->select ->joinLeft (
6266 ["ntp " => $ this ->prefix . 'timeperiods ' ],
Original file line number Diff line number Diff line change @@ -59,12 +59,17 @@ public static function fetch(TLVTree $root)
5959 'service_in_downtime ' ,
6060 );
6161
62+ $ options = [];
63+ foreach (['notification_periods ' , 'host_never_unhandled ' , 'ignored_notification_periods ' ] as $ opt ) {
64+ $ options [$ opt ] = $ root ->get ($ opt );
65+ }
66+
6267 if ($ root ->get ('notification_periods ' ) === true ) {
6368 $ columns [] = 'service_in_notification_period ' ;
6469 }
6570
6671 // Note: this uses a patched version of Servicestatus / ServicestatusQuery !
67- $ services = new Servicestatus ($ root ->getBackend (), $ columns );
72+ $ services = new Servicestatus ($ root ->getBackend (), $ columns, $ options );
6873 $ services ->where ('host_name ' , $ names );
6974
7075 foreach ($ services as $ service ) {
You can’t perform that action at this time.
0 commit comments