@@ -281,29 +281,31 @@ private function addIcingadbHostsToPoints()
281281 $ this ->icingadbUtils ->applyRestrictions ($ hostQuery );
282282
283283 $ hostQuery = $ hostQuery ->execute ();
284- if ($ hostQuery ->hasResult ()) {
285- foreach ($ hostQuery as $ row ) {
286- if (! preg_match ($ this ->coordinatePattern , $ row ->vars ['geolocation ' ])) {
287- continue ;
288- }
284+ if (! $ hostQuery ->hasResult ()) {
285+ return ;
286+ }
287+
288+ foreach ($ hostQuery as $ row ) {
289+ if (! preg_match ($ this ->coordinatePattern , $ row ->vars ['geolocation ' ])) {
290+ continue ;
291+ }
289292
290- $ hostname = $ row ->name ;
291- if (! isset ($ this ->points ['hosts ' ][$ hostname ])) {
292- $ host = $ this ->populateObjectColumnsToArray ($ row );
293- $ host ['host_problem ' ] = $ row ->state ->is_problem ? 1 : 0 ;
294- $ host ['coordinates ' ] = $ row ->vars ['geolocation ' ];
295- $ host ['icon ' ] = $ row ->vars ['map_icon ' ] ?? null ;
296- $ host ['coordinates ' ] = explode (", " , $ host ['coordinates ' ]);
293+ $ hostname = $ row ->name ;
294+ if (! isset ($ this ->points ['hosts ' ][$ hostname ])) {
295+ $ host = $ this ->populateObjectColumnsToArray ($ row );
296+ $ host ['host_problem ' ] = $ row ->state ->is_problem ? 1 : 0 ;
297+ $ host ['coordinates ' ] = $ row ->vars ['geolocation ' ];
298+ $ host ['icon ' ] = $ row ->vars ['map_icon ' ] ?? null ;
299+ $ host ['coordinates ' ] = explode (", " , $ host ['coordinates ' ]);
297300
298- $ host ['services ' ] = [];
301+ $ host ['services ' ] = [];
299302
300- $ this ->points ['hosts ' ][$ row ->name ] = $ host ;
301- }
303+ $ this ->points ['hosts ' ][$ row ->name ] = $ host ;
304+ }
302305
303- if ($ row ->service ->id !== null ) {
304- $ service = $ this ->populateObjectColumnsToArray ($ row ->service );
305- $ this ->points ['hosts ' ][$ hostname ]['services ' ][$ row ->service ->display_name ] = $ service ;
306- }
306+ if ($ row ->service ->id !== null ) {
307+ $ service = $ this ->populateObjectColumnsToArray ($ row ->service );
308+ $ this ->points ['hosts ' ][$ hostname ]['services ' ][$ row ->service ->display_name ] = $ service ;
307309 }
308310 }
309311
@@ -357,24 +359,27 @@ private function addIcingadbServicesToPoints()
357359
358360 $ this ->icingadbUtils ->applyRestrictions ($ serviceQuery );
359361 $ serviceQuery = $ serviceQuery ->execute ();
360- if ($ serviceQuery ->hasResult ()) {
361- foreach ($ serviceQuery as $ row ) {
362- if (! preg_match ($ this ->coordinatePattern , $ row ->vars ['geolocation ' ])) {
363- continue ;
364- }
365362
366- $ identifier = $ row ->host ->name . "! " . $ row ->name ;
367- $ host = $ this ->populateObjectColumnsToArray ($ row ->host );
368- $ host ['coordinates ' ] = $ row ->vars ['geolocation ' ];
369- $ host ['icon ' ] = $ row ->vars ['map_icon ' ] ?? null ;
370- $ host ['coordinates ' ] = explode (", " , $ host ['coordinates ' ]);
363+ if (! $ serviceQuery ->hasResult ()) {
364+ return ;
365+ }
371366
372- $ service = $ this ->populateObjectColumnsToArray ($ row );
367+ foreach ($ serviceQuery as $ row ) {
368+ if (! preg_match ($ this ->coordinatePattern , $ row ->vars ['geolocation ' ])) {
369+ continue ;
370+ }
373371
374- $ host ['services ' ][$ row ->display_name ] = $ service ;
372+ $ identifier = $ row ->host ->name . "! " . $ row ->name ;
373+ $ host = $ this ->populateObjectColumnsToArray ($ row ->host );
374+ $ host ['coordinates ' ] = $ row ->vars ['geolocation ' ];
375+ $ host ['icon ' ] = $ row ->vars ['map_icon ' ] ?? null ;
376+ $ host ['coordinates ' ] = explode (", " , $ host ['coordinates ' ]);
375377
376- $ this ->points ['services ' ][$ identifier ] = $ host ;
377- }
378+ $ service = $ this ->populateObjectColumnsToArray ($ row );
379+
380+ $ host ['services ' ][$ row ->display_name ] = $ service ;
381+
382+ $ this ->points ['services ' ][$ identifier ] = $ host ;
378383 }
379384 }
380385
0 commit comments