summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-03-20 08:32:30 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-03-20 08:32:30 +0000
commitc628c6d120a5e4f3899d342d7e96a256404b795c (patch)
tree5eb31bd40a5982bd08cc9378dfa305a977d1b1c6 /frontends/php/include
parent868a3852584b13e03c84442cb6dad32971f9b127 (diff)
downloadzabbix-c628c6d120a5e4f3899d342d7e96a256404b795c.tar.gz
zabbix-c628c6d120a5e4f3899d342d7e96a256404b795c.tar.xz
zabbix-c628c6d120a5e4f3899d342d7e96a256404b795c.zip
- hard-linked templates works when deleting graph element (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@1718 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/graphs.inc.php39
1 files changed, 37 insertions, 2 deletions
diff --git a/frontends/php/include/graphs.inc.php b/frontends/php/include/graphs.inc.php
index 88c2476d..f6d39809 100644
--- a/frontends/php/include/graphs.inc.php
+++ b/frontends/php/include/graphs.inc.php
@@ -130,11 +130,11 @@
$graph=get_graph_by_graphid($graph_item["graphid"]);
$item=get_item_by_itemid($graph_item["itemid"]);
- $sql="select hostid,templateid,actions from hosts_templates where templateid=".$item["hostid"];
+ $sql="select hostid,templateid,graphs from hosts_templates where templateid=".$item["hostid"];
$result=DBselect($sql);
while($row=DBfetch($result))
{
- if($row["actions"]&1 == 0) continue;
+ if($row["graphs"]&1 == 0) continue;
$sql="select i.itemid from items i where i.key_='".$item["key_"]."' and i.hostid=".$row["hostid"];
$result2=DBselect($sql);
@@ -155,4 +155,39 @@
}
}
}
+
+ function delete_graph_item_from_templates($gitemid)
+ {
+ if($gitemid<=0)
+ {
+ return;
+ }
+
+ $graph_item=get_graphitem_by_gitemid($gitemid);
+ $graph=get_graph_by_graphid($graph_item["graphid"]);
+ $item=get_item_by_itemid($graph_item["itemid"]);
+
+ $sql="select hostid,templateid,graphs from hosts_templates where templateid=".$item["hostid"];
+ echo $sql,"<br>";
+ $result=DBselect($sql);
+ while($row=DBfetch($result))
+ {
+ if($row["graphs"]&4 == 0) continue;
+
+ $sql="select i.itemid from items i where i.key_='".$item["key_"]."' and i.hostid=".$row["hostid"];
+ echo $sql,"<br>";
+ $result2=DBselect($sql);
+ if(DBnum_rows($result2)==0) continue;
+ $row2=DBfetch($result2);
+ $itemid=$row2["itemid"];
+
+ $sql="select distinct gi.gitemid from graphs_items gi,items i where i.itemid=gi.itemid and i.hostid=".$row["hostid"]." and i.itemid=$itemid";
+ echo $sql,"<br>";
+ $result2=DBselect($sql);
+ while($row2=DBfetch($result2))
+ {
+ delete_graphs_item($row2["gitemid"]);
+ }
+ }
+ }
?>