diff options
Diffstat (limited to 'ui/include/hosts.inc.php')
-rw-r--r-- | ui/include/hosts.inc.php | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/ui/include/hosts.inc.php b/ui/include/hosts.inc.php index adebef0d10f..41f50ab4884 100644 --- a/ui/include/hosts.inc.php +++ b/ui/include/hosts.inc.php @@ -741,73 +741,6 @@ function makeHostPrototypeTemplatesHtml($host_prototypeid, array $parent_templat return $list; } -/** - * Get host ids of hosts which $groupids can be unlinked from. - * if $hostids is passed, function will check only these hosts. - * - * @param array $groupids - * @param array $hostids - * - * @return array - */ -function getUnlinkableHostIds(array $groupIds, array $hostIds) { - if (!$hostIds) { - return []; - } - - $dbResult = DBselect( - 'SELECT hg.hostid'. - ' FROM hosts_groups hg'. - ' WHERE '.dbConditionInt('hg.groupid', $groupIds, true). - ' AND '.dbConditionInt('hg.hostid', $hostIds). - ' GROUP BY hg.hostid' - ); - - $unlinkableHostIds = []; - while ($dbRow = DBfetch($dbResult)) { - $unlinkableHostIds[] = $dbRow['hostid']; - } - - return $unlinkableHostIds; -} - -function getDeletableHostGroupIds(array $groupIds) { - // selecting the list of hosts linked to the host groups - $dbResult = DBselect( - 'SELECT hg.hostid'. - ' FROM hosts_groups hg'. - ' WHERE '.dbConditionInt('hg.groupid', $groupIds) - ); - - $linkedHostIds = []; - while ($dbRow = DBfetch($dbResult)) { - $linkedHostIds[] = $dbRow['hostid']; - } - - // the list of hosts which can be unlinked from the host groups - $hostIds = getUnlinkableHostIds($groupIds, $linkedHostIds); - - $dbResult = DBselect( - 'SELECT g.groupid'. - ' FROM hstgrp g'. - ' WHERE g.internal='.ZBX_NOT_INTERNAL_GROUP. - ' AND '.dbConditionInt('g.groupid', $groupIds). - ' AND NOT EXISTS ('. - 'SELECT NULL'. - ' FROM hosts_groups hg'. - ' WHERE g.groupid=hg.groupid'. - ($hostIds ? ' AND '.dbConditionInt('hg.hostid', $hostIds, true) : ''). - ')' - ); - - $deletableGroupIds = []; - while ($dbRow = DBfetch($dbResult)) { - $deletableGroupIds[$dbRow['groupid']] = $dbRow['groupid']; - } - - return $deletableGroupIds; -} - function isTemplate($hostId) { $dbHost = DBfetch(DBselect('SELECT h.status FROM hosts h WHERE h.hostid='.zbx_dbstr($hostId))); |