Private GIT

Skip to content
Snippets Groups Projects
Commit 8db7b2b9 authored by loiclau's avatar loiclau Committed by Kev
Browse files

add check before foreach

parent 8a3ee486
No related branches found
No related tags found
No related merge requests found
......@@ -600,7 +600,7 @@ class CentreonRtDowntime extends CentreonObject
$unknownHg[] = $hg;
}
}
if (count($existingHg)) {
foreach ($existingHg as $hg) {
$hostList = $this->hgObject->getHostsByHostgroupName($hg);
//check add services with host
......@@ -616,7 +616,7 @@ class CentreonRtDowntime extends CentreonObject
);
}
}
}
if (count($unknownHg)) {
throw new CentreonClapiException(self::OBJECT_NOT_FOUND . ' HG : ' . implode('|', $unknownHg));
}
......@@ -656,6 +656,7 @@ class CentreonRtDowntime extends CentreonObject
}
}
if (count($existingSg)) {
foreach ($existingSg as $sg) {
$serviceList = $this->sgObject->getServicesByServicegroupName($sg);
foreach ($serviceList as $service) {
......@@ -670,6 +671,7 @@ class CentreonRtDowntime extends CentreonObject
);
}
}
}
if (count($unknownSg)) {
throw new CentreonClapiException(self::OBJECT_NOT_FOUND . ' SG : ' . implode('|', $unknownSg));
......@@ -709,6 +711,7 @@ class CentreonRtDowntime extends CentreonObject
}
}
if (count($existingPoller)) {
foreach ($existingPoller as $poller) {
$hostList = $this->instanceObject->getHostsByInstance($poller);
//check add services with host with true in last param
......@@ -724,6 +727,7 @@ class CentreonRtDowntime extends CentreonObject
);
}
}
}
if (count($unknownPoller)) {
throw new CentreonClapiException(self::OBJECT_NOT_FOUND . ' INSTANCE : ' . implode('|', $unknownPoller));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment