From d0f11e10f692bfc64b5781f043228d251efbeedf Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 29 Sep 2015 22:44:12 +0200 Subject: [PATCH] monitoring: Rearrange code in the HoststatusQuery refs #9956 --- .../Backend/Ido/Query/HoststatusQuery.php | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php index cfb1b213f..f8fb4a27b 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HoststatusQuery.php @@ -26,8 +26,8 @@ class HoststatusQuery extends IdoQuery * {@inheritdoc} */ protected $columnMap = array( - 'instances' => array( - 'instance_name' => 'i.instance_name' + 'checktimeperiods' => array( + 'host_check_timeperiod' => 'ctp.alias COLLATE latin1_general_ci' ), 'hostgroups' => array( 'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci', @@ -158,6 +158,9 @@ class HoststatusQuery extends IdoQuery 'host_status_update_time' => 'hs.status_update_time', 'host_unhandled' => 'CASE WHEN (hs.problem_has_been_acknowledged + hs.scheduled_downtime_depth) = 0 THEN 1 ELSE 0 END' ), + 'instances' => array( + 'instance_name' => 'i.instance_name' + ), 'servicegroups' => array( 'servicegroup' => 'sgo.name1 COLLATE latin1_general_ci', 'servicegroup_name' => 'sgo.name1', @@ -167,9 +170,6 @@ class HoststatusQuery extends IdoQuery 'service' => 'so.name2 COLLATE latin1_general_ci', 'service_description' => 'so.name2', 'service_display_name' => 's.display_name COLLATE latin1_general_ci', - ), - 'checktimeperiods' => array( - 'host_check_timeperiod' => 'ctp.alias COLLATE latin1_general_ci' ) ); @@ -197,6 +197,18 @@ class HoststatusQuery extends IdoQuery $this->joinedVirtualTables['hosts'] = true; } + /** + * Join check time periods + */ + protected function joinChecktimeperiods() + { + $this->select->joinLeft( + array('ctp' => $this->prefix . 'timeperiods'), + 'ctp.timeperiod_object_id = h.check_timeperiod_object_id', + array() + ); + } + /** * Join host groups */ @@ -229,6 +241,18 @@ class HoststatusQuery extends IdoQuery ); } + /** + * Join instances + */ + protected function joinInstances() + { + $this->select->join( + array('i' => $this->prefix . 'instances'), + 'i.instance_id = ho.instance_id', + array() + ); + } + /** * Join service groups */ @@ -267,27 +291,6 @@ class HoststatusQuery extends IdoQuery ); } - /** - * Join instances - */ - protected function joinInstances() - { - $this->select->join( - array('i' => $this->prefix . 'instances'), - 'i.instance_id = ho.instance_id', - array() - ); - } - - protected function joinChecktimeperiods() - { - $this->select->joinLeft( - array('ctp' => $this->prefix . 'timeperiods'), - 'ctp.timeperiod_object_id = h.check_timeperiod_object_id', - array() - ); - } - /** * Query the service problem summary for all hosts of this query's result set *