diff options
| author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-04-14 13:26:42 +0000 |
|---|---|---|
| committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-04-14 13:26:42 +0000 |
| commit | 5348f67b28ed1da2539db6de7a11c605a5dc3a57 (patch) | |
| tree | 4646832d5a7263dbe6818409d9ce9e9dff419008 /frontends/php/include/graphs.inc.php | |
| parent | c44eed92d3f3bcfc0efad6e18e31323f089a9ce6 (diff) | |
- [DEV-142] added transactions to DB actions (beta) (Artem)
- [DEV-137] improvements in permission checks (Artem)
- [DEV-137] changes in schema (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5619 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/graphs.inc.php')
| -rw-r--r-- | frontends/php/include/graphs.inc.php | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/frontends/php/include/graphs.inc.php b/frontends/php/include/graphs.inc.php index d42a687d..9c5867ac 100644 --- a/frontends/php/include/graphs.inc.php +++ b/frontends/php/include/graphs.inc.php @@ -197,7 +197,7 @@ if(is_null($perm_res)) $perm_res = PERM_RES_STRING_LINE; - $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, $perm, null, null, $nodeid); + $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, $perm, null, $nodeid); $denied_graphs = array(); $result = array(); @@ -220,7 +220,7 @@ (!empty($hostid)?' AND i.hostid='.$hostid:''). ' AND i.itemid=gi.itemid '. ' AND i.status='.ITEM_STATUS_ACTIVE. - (!empty($denied_graphs)?' AND g.graphid NOT IN ('.implode(',',$denied_graphs).')':''); + (!empty($denied_graphs)?' AND g.graphid NOT IN ('.implode(',',$denied_graphs).')':''); $db_graphs = DBselect($sql); while($graph = DBfetch($db_graphs)){ @@ -632,21 +632,20 @@ while($db_host = DBfetch($db_hosts)){ $host_list[] = '"'.$db_host['host'].'"'; } - + + $result = true; /* firstly remove child graphs */ $chd_graphs = get_graphs_by_templateid($graphid); - while($chd_graph = DBfetch($chd_graphs)) - { /* recursion */ - if ( !($result = delete_graph($chd_graph['graphid'])) ) - return $result; + while($chd_graph = DBfetch($chd_graphs)){ /* recursion */ + $result &= delete_graph($chd_graph['graphid']); } - DBexecute('delete from screens_items where resourceid='.$graphid.' and resourcetype='.SCREEN_RESOURCE_GRAPH); + $result &= DBexecute('DELETE FROM screens_items WHERE resourceid='.$graphid.' AND resourcetype='.SCREEN_RESOURCE_GRAPH); /* delete graph */ - $result = DBexecute('DELETE FROM graphs_items WHERE graphid='.$graphid); + $result &= DBexecute('DELETE FROM graphs_items WHERE graphid='.$graphid); $result &= DBexecute('DELETE FROM graphs WHERE graphid='.$graphid); - $result &= rm4favorites('web.favorite.graphids',$graphid,ZBX_FAVORITES_ALL,'graphid'); + $result &= DBexecute('DELETE FROM profiles WHERE idx="web.favorite.graphids" AND resource="graphid" AND value='.$graphid); if($result){ info('Graph "'.$graph['name'].'" deleted from hosts '.implode(',',$host_list)); |
