Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
fix(clapi): avoid to order parentship several times (#6373)
Browse files Browse the repository at this point in the history
Refs: #6372
  • Loading branch information
kduret authored Jul 6, 2018
1 parent f39428f commit 60a37af
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions www/class/centreon-clapi/centreonHost.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,6 @@ public function export($filters = null)
$tpObj = new \Centreon_Object_Timeperiod();
$macroObj = new \Centreon_Object_Host_Macro_Custom();
$instanceRel = new \Centreon_Object_Relation_Instance_Host();
$parentShip = array();

if ($this->register) {
$instElements = $instanceRel->getMergedParameters(
Expand All @@ -1141,6 +1140,12 @@ public function export($filters = null)
);
}

/* Init parentship */
$parentShip = array();
if ($this->register == 1) {
$parentShip = $this->getHostListByParent($elements);
}

foreach ($elements as $element) {
$addStr = $this->action . $this->delim . "ADD";
foreach ($this->insertParams as $param) {
Expand Down Expand Up @@ -1194,9 +1199,6 @@ public function export($filters = null)
}

// Set parentship
if ($this->register == 1) {
$parentShip = $this->getHostListByParent($elements);
}
if (isset($parentShip[$element[$this->object->getPrimaryKey()]])) {
foreach ($parentShip[$element[$this->object->getPrimaryKey()]] as $parentId) {
echo $this->action . $this->delim
Expand Down

0 comments on commit 60a37af

Please sign in to comment.