diff options
Diffstat (limited to 'ui/hosts.php')
-rw-r--r-- | ui/hosts.php | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/ui/hosts.php b/ui/hosts.php index 74e360f6484..d1bed15beff 100644 --- a/ui/hosts.php +++ b/ui/hosts.php @@ -839,16 +839,9 @@ elseif (hasRequest('add') || hasRequest('update')) { } if ($create) { - $hostIds = API::Host()->create($host); - - if ($hostIds) { - $hostId = reset($hostIds['hostids']); - } - else { + if (!API::Host()->create($host)) { throw new Exception(); } - - add_audit_ext(AUDIT_ACTION_ADD, AUDIT_RESOURCE_HOST, $hostId, $host['host'], null, null, null); } else { $host['hostid'] = $hostId; @@ -856,16 +849,6 @@ elseif (hasRequest('add') || hasRequest('update')) { if (!API::Host()->update($host)) { throw new Exception(); } - - $dbHostNew = API::Host()->get([ - 'output' => API_OUTPUT_EXTEND, - 'hostids' => $hostId, - 'editable' => true - ]); - $dbHostNew = reset($dbHostNew); - - add_audit_ext(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_HOST, $dbHostNew['hostid'], $dbHostNew['host'], 'hosts', - $dbHost, $dbHostNew); } // full clone @@ -1001,13 +984,14 @@ elseif (hasRequest('hosts') && hasRequest('action') && str_in_array(getRequest(' 'templated_hosts' => true, 'output' => ['hostid'] ]); - $actHosts = zbx_objectValues($actHosts, 'hostid'); if ($actHosts) { - DBstart(); + foreach ($actHosts as &$host) { + $host['status'] = $status; + } + unset($host); - $result = updateHostStatus($actHosts, $status); - $result = DBend($result); + $result = (bool) API::Host()->update($actHosts); if ($result) { uncheckTableRows(); |