"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ui/include/classes/api/services/CHostPrototype.php" between
zabbix-5.4.0.tar.gz and zabbix-5.4.1.tar.gz

About: ZABBIX is an enterprise-class distributed monitoring solution for servers and applications.

CHostPrototype.php  (zabbix-5.4.0):CHostPrototype.php  (zabbix-5.4.1)
skipping to change at line 1437 skipping to change at line 1437
]); ]);
foreach ($groupPrototypes as &$groupPrototype) { foreach ($groupPrototypes as &$groupPrototype) {
unset($groupPrototype['groupid']); unset($groupPrototype['groupid']);
} }
unset($groupPrototype); unset($groupPrototype);
$result = $relationMap->mapMany($result, $groupPrototypes , 'groupPrototypes'); $result = $relationMap->mapMany($result, $groupPrototypes , 'groupPrototypes');
} }
// adding host // adding host
if ($options['selectParentHost'] !== null && $options['selectPare ntHost'] != API_OUTPUT_COUNT) { if ($options['selectParentHost'] !== null && $options['selectPare ntHost'] != API_OUTPUT_COUNT) {
$hosts = [];
$relationMap = new CRelationMap(); $relationMap = new CRelationMap();
$dbRules = DBselect( $dbRules = DBselect(
'SELECT hd.hostid,i.hostid AS parent_hostid'. 'SELECT hd.hostid,i.hostid AS parent_hostid'.
' FROM host_discovery hd,items i'. ' FROM host_discovery hd,items i'.
' WHERE '.dbConditionInt('hd.hostid', $ho stPrototypeIds). ' WHERE '.dbConditionInt('hd.hostid', $ho stPrototypeIds).
' AND hd.parent_itemid=i.itemid' ' AND hd.parent_itemid=i.itemid'
); );
while ($relation = DBfetch($dbRules)) { while ($relation = DBfetch($dbRules)) {
$relationMap->addRelation($relation['hostid'], $r elation['parent_hostid']); $relationMap->addRelation($relation['hostid'], $r elation['parent_hostid']);
} }
$hosts = API::Host()->get([ $related_ids = $relationMap->getRelatedIds();
'output' => $options['selectParentHost'],
'hostids' => $relationMap->getRelatedIds(), if ($related_ids) {
'templated_hosts' => true, $hosts = API::Host()->get([
'nopermissions' => true, 'output' => $options['selectParentHost'],
'preservekeys' => true 'hostids' => $related_ids,
]); 'templated_hosts' => true,
'nopermissions' => true,
'preservekeys' => true
]);
}
$result = $relationMap->mapOne($result, $hosts, 'parentHo st'); $result = $relationMap->mapOne($result, $hosts, 'parentHo st');
} }
// adding templates // adding templates
if ($options['selectTemplates'] !== null) { if ($options['selectTemplates'] !== null) {
if ($options['selectTemplates'] != API_OUTPUT_COUNT) { if ($options['selectTemplates'] != API_OUTPUT_COUNT) {
$templates = [];
$relationMap = $this->createRelationMap($result, 'hostid', 'templateid', 'hosts_templates'); $relationMap = $this->createRelationMap($result, 'hostid', 'templateid', 'hosts_templates');
$templates = API::Template()->get([ $related_ids = $relationMap->getRelatedIds();
'output' => $options['selectTemplates'],
'templateids' => $relationMap->getRelated if ($related_ids) {
Ids(), $templates = API::Template()->get([
'preservekeys' => true 'output' => $options['selectTempl
]); ates'],
'templateids' => $related_ids,
'preservekeys' => true
]);
}
$result = $relationMap->mapMany($result, $templat es, 'templates'); $result = $relationMap->mapMany($result, $templat es, 'templates');
} }
else { else {
$templates = API::Template()->get([ $templates = API::Template()->get([
'hostids' => $hostPrototypeIds, 'hostids' => $hostPrototypeIds,
'countOutput' => true, 'countOutput' => true,
'groupCount' => true 'groupCount' => true
]); ]);
$templates = zbx_toHash($templates, 'hostid'); $templates = zbx_toHash($templates, 'hostid');
foreach ($result as $hostid => $host) { foreach ($result as $hostid => $host) {
 End of changes. 4 change blocks. 
13 lines changed or deleted 25 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)