summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/config.inc.php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2004-02-17 22:41:20 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2004-02-17 22:41:20 +0000
commit33ca5f663dca2bb55a10c10aa45acedb5be130ab (patch)
tree6485d246586d97c180d6ab2ab336206544d74b8a /frontends/php/include/config.inc.php
parent64783dd7e2037814b9e114dfebb001f0351d6878 (diff)
downloadzabbix-33ca5f663dca2bb55a10c10aa45acedb5be130ab.tar.gz
zabbix-33ca5f663dca2bb55a10c10aa45acedb5be130ab.tar.xz
zabbix-33ca5f663dca2bb55a10c10aa45acedb5be130ab.zip
Improvements for new algorithm for action handling.
git-svn-id: svn://svn.zabbix.com/trunk@1262 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/config.inc.php')
-rw-r--r--frontends/php/include/config.inc.php27
1 files changed, 24 insertions, 3 deletions
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index fbea7393..2348dee3 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -178,10 +178,31 @@
function get_action_count_by_triggerid($triggerid)
{
- $sql="select count(*) as cnt from actions where triggerid=$triggerid";
+ $cnt=0;
+
+ $sql="select count(*) as cnt from actions where triggerid=$triggerid and scope=0";
$result=DBselect($sql);
$row=DBfetch($result);
- return $row["cnt"];
+
+ $cnt=$cnt+$row["cnt"];
+
+ $sql="select count(*) as cnt from actions where scope=2";
+ $result=DBselect($sql);
+ $row=DBfetch($result);
+
+ $cnt=$cnt+$row["cnt"];
+
+ $sql="select distinct h.hostid from hosts h,items i,triggers t,functions f where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=t.triggerid and t.triggerid=$triggerid";
+ $result=DBselect($sql);
+ while($row=DBfetch($result))
+ {
+ $sql="select count(*) as cnt from actions a,hosts h,items i,triggers t,functions f where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=t.triggerid and a.triggerid=".$row["hostid"]." and a.scope=1 and t.triggerid";
+ $result2=DBselect($sql);
+ $row2=DBfetch($result2);
+ $cnt=$cnt+$row2["cnt"];
+ }
+
+ return $cnt;
}
function check_anyright($right,$permission)
@@ -2790,7 +2811,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
DBexecute($sql);
}
# Add actions
- $sql="select actionid from actions where triggerid=".$row2["triggerid"];
+ $sql="select actionid from actions where scope=0 and triggerid=".$row2["triggerid"];
$result3=DBselect($sql);
while($row3=DBfetch($result3))
{