diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-03-17 10:02:59 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-03-17 10:02:59 +0000 |
| commit | e990ea261f1094378b664d754fdff4f839177a71 (patch) | |
| tree | 67743aa71d446389fc55a5c96d4e567b3828339d /frontends/php/include | |
| parent | 245f25c1cddd1f9f980a2e3171ec091a844ed1f3 (diff) | |
| download | zabbix-e990ea261f1094378b664d754fdff4f839177a71.tar.gz zabbix-e990ea261f1094378b664d754fdff4f839177a71.tar.xz zabbix-e990ea261f1094378b664d754fdff4f839177a71.zip | |
- hard-linked templates works when deleting an action (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@1706 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/actions.inc.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/frontends/php/include/actions.inc.php b/frontends/php/include/actions.inc.php index 85849ab8..57d74467 100644 --- a/frontends/php/include/actions.inc.php +++ b/frontends/php/include/actions.inc.php @@ -138,4 +138,47 @@ } } } + + # Delete action from hardlinked hosts + + function delete_action_from_templates($actionid) + { + if($actionid<=0) + { + return; + } + + $action=get_action_by_actionid($actionid); + $trigger=get_trigger_by_triggerid($action["triggerid"]); + + $sql="select distinct h.hostid from hosts h,functions f, items i where i.itemid=f.itemid and h.hostid=i.hostid and f.triggerid=".$action["triggerid"]; + $result=DBselect($sql); + if(DBnum_rows($result)!=1) + { + return; + } + + $row=DBfetch($result); + + $hostid=$row["hostid"]; + + $sql="select hostid,templateid,actions from hosts_templates where templateid=$hostid"; + $result=DBselect($sql); + while($row=DBfetch($result)) + { + if($row["actions"]&4 == 0) continue; + + $sql="select distinct f.triggerid from functions f,items i,triggers t where t.description='".addslashes($trigger["description"])."' and t.triggerid=f.triggerid and i.itemid=f.itemid and i.hostid=".$row["hostid"]; + $result2=DBselect($sql); + while($row2=DBfetch($result2)) + { + $sql="select actionid from actions where triggerid=".$row2["triggerid"]." and subject='".addslashes($action["subject"])."' and message='".addslashes($action["message"])."' and userid=".$action["userid"]." and good=".$action["good"]." and scope=".$action["scope"]." and recipient=".$action["recipient"]." and severity=".$action["severity"]; + $result3=DBselect($sql); + while($row3=DBfetch($result3)) + { + delete_action($row3["actionid"]); + } + } + } + } ?> |
