diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-04-11 13:48:54 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-04-11 13:48:54 +0000 |
| commit | 40f02befd74d08d10eb2e5be7c28c520aa704e95 (patch) | |
| tree | 2fedab2bdfeb35c550d72643ed33617d6527aa82 /frontends/php/include/items.inc.php | |
| parent | 978b1dec1f8ed2d7aa61d56bb9c183b8a286eb3b (diff) | |
| download | zabbix-40f02befd74d08d10eb2e5be7c28c520aa704e95.tar.gz zabbix-40f02befd74d08d10eb2e5be7c28c520aa704e95.tar.xz zabbix-40f02befd74d08d10eb2e5be7c28c520aa704e95.zip | |
- fixed items status changing of parent hosts (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2729 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/items.inc.php')
| -rw-r--r-- | frontends/php/include/items.inc.php | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php index 23562cab..13820bbd 100644 --- a/frontends/php/include/items.inc.php +++ b/frontends/php/include/items.inc.php @@ -179,12 +179,14 @@ error("Insufficient permissions"); return 0; } + if($status==ITEM_STATUS_ACTIVE) $sql="update items set status=$status,error='' where itemid=$itemid"; else $sql="update items set status=$status where itemid=$itemid"; - return DBexecute($sql); + $result = DBexecute($sql); + return $result; } # Update Item definition @@ -334,14 +336,32 @@ function activate_item($itemid) { - return DBexecute("update items set status=".ITEM_STATUS_ACTIVE." where itemid=$itemid"); + // first update status for child items + $db_tmp_items = DBselect("select itemid, hostid from items where templateid=$itemid"); + while($db_tmp_item = DBfetch($db_tmp_items)) + { + // recursion + activate_item($db_tmp_item["itemid"]); + } + + $result = DBexecute("update items set status=".ITEM_STATUS_ACTIVE.",error='' where itemid=$itemid"); + return $result; } # Disable Item function disable_item($itemid) { - return DBexecute("update items set status=".ITEM_STATUS_DISABLED." where itemid=$itemid"); + // first update status for child items + $db_tmp_items = DBselect("select itemid, hostid from items where templateid=$itemid"); + while($db_tmp_item = DBfetch($db_tmp_items)) + { + // recursion + disable_item($db_tmp_item["itemid"]); + } + + $result = DBexecute("update items set status=".ITEM_STATUS_DISABLED." where itemid=$itemid"); + return $result; } function get_items_by_hostid($hostid) |
