From: Florian G. <re...@us...> - 2008-04-24 22:29:29
|
Update of /cvsroot/perfparse/_perfparse-phpgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12195/phpgui Modified Files: utils.php Log Message: make deletion policies less complex. No individual settings in objects allowed any more. Index: utils.php =================================================================== RCS file: /cvsroot/perfparse/_perfparse-phpgui/utils.php,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** utils.php 3 Dec 2007 20:39:03 -0000 1.47 --- utils.php 24 Apr 2008 22:29:09 -0000 1.48 *************** *** 647,658 **** function get_metric_bin_del_policy(&$db,$metric_id) { ! $query='select bin_delete_policy_individual,policy_name,delete_policy_seconds from perfdata_service_metric left join perfdata_delete_policy on bin_delete_policy_id=policy_id where metric_id=?'; if(!$res=$db->GetRow($query,array($metric_id))) { return(FALSE); } - if($res['bin_delete_policy_individual']!==NULL) { - return(array('source'=>'Individual','policy_seconds'=>$res['bin_delete_policy_individual'])); - } if($res['policy_name']!==NULL) { return(array('source'=>'Metric Policy','policy_name'=>$res['policy_name'],'policy_seconds'=>$res['delete_policy_seconds'])); --- 647,655 ---- function get_metric_bin_del_policy(&$db,$metric_id) { ! $query='select policy_name,delete_policy_seconds from perfdata_service_metric left join perfdata_delete_policy on bin_delete_policy_id=policy_id where metric_id=?'; if(!$res=$db->GetRow($query,array($metric_id))) { return(FALSE); } if($res['policy_name']!==NULL) { return(array('source'=>'Metric Policy','policy_name'=>$res['policy_name'],'policy_seconds'=>$res['delete_policy_seconds'])); *************** *** 663,667 **** function get_host_bin_del_policy(&$db,$host_id) { // if policy set in host ! $query='select h.bin_delete_policy_individual,d.policy_name,d.delete_policy_seconds from perfdata_host h left join perfdata_delete_policy d on h.bin_delete_policy_id=d.policy_id where h.host_id=? '; --- 660,664 ---- function get_host_bin_del_policy(&$db,$host_id) { // if policy set in host ! $query='select d.policy_name,d.delete_policy_seconds from perfdata_host h left join perfdata_delete_policy d on h.bin_delete_policy_id=d.policy_id where h.host_id=? '; *************** *** 669,675 **** return(FALSE); } - if($res['bin_delete_policy_individual']!==NULL) { - return(array('source'=>'Host Individual','policy_seconds'=>$res['bin_delete_policy_individual'])); - } if($res['policy_name']!==NULL) { return(array('source'=>'Host Policy','policy_name'=>$res['policy_name'],'policy_seconds'=>$res['delete_policy_seconds'])); --- 666,669 ---- *************** *** 680,684 **** function get_host_raw_del_policy(&$db,$host_id) { // if policy set in host ! $query='select h.raw_delete_policy_individual,d.policy_name,d.delete_policy_seconds from perfdata_host h left join perfdata_delete_policy d on h.raw_delete_policy_id=d.policy_id where h.host_id=? '; --- 674,678 ---- function get_host_raw_del_policy(&$db,$host_id) { // if policy set in host ! $query='select d.policy_name,d.delete_policy_seconds from perfdata_host h left join perfdata_delete_policy d on h.raw_delete_policy_id=d.policy_id where h.host_id=? '; *************** *** 686,692 **** return(FALSE); } - if($res['raw_delete_policy_individual']!==NULL) { - return(array('source'=>'Host Individual','policy_seconds'=>$res['raw_delete_policy_individual'])); - } if($res['policy_name']!==NULL) { return(array('source'=>'Host Policy','policy_name'=>$res['policy_name'],'policy_seconds'=>$res['delete_policy_seconds'])); --- 680,683 ---- *************** *** 697,701 **** function get_group_bin_del_policy(&$db,$group_id) { // if policy set in group ! $query='select g.bin_delete_policy_individual,d.policy_name,d.delete_policy_seconds from perfdata_groups g left join perfdata_delete_policy d on g.bin_delete_policy_id=d.policy_id where g.group_id=? '; --- 688,692 ---- function get_group_bin_del_policy(&$db,$group_id) { // if policy set in group ! $query='select d.policy_name,d.delete_policy_seconds from perfdata_groups g left join perfdata_delete_policy d on g.bin_delete_policy_id=d.policy_id where g.group_id=? '; *************** *** 703,709 **** return(FALSE); } - if($res['bin_delete_policy_individual']!==NULL) { - return(array('source'=>'Group Individual','policy_seconds'=>$res['bin_delete_policy_individual'])); - } if($res['policy_name']!==NULL) { return(array('source'=>'Group Policy','policy_name'=>$res['policy_name'],'policy_seconds'=>$res['delete_policy_seconds'])); --- 694,697 ---- *************** *** 714,718 **** function get_group_raw_del_policy(&$db,$group_id) { // if policy set in group ! $query='select g.raw_delete_policy_individual,d.policy_name,d.delete_policy_seconds from perfdata_groups g left join perfdata_delete_policy d on g.raw_delete_policy_id=d.policy_id where g.group_id=? '; --- 702,706 ---- function get_group_raw_del_policy(&$db,$group_id) { // if policy set in group ! $query='select d.policy_name,d.delete_policy_seconds from perfdata_groups g left join perfdata_delete_policy d on g.raw_delete_policy_id=d.policy_id where g.group_id=? '; *************** *** 720,726 **** return(FALSE); } - if($res['raw_delete_policy_individual']!==NULL) { - return(array('source'=>'Group Individual','policy_seconds'=>$res['raw_delete_policy_individual'])); - } if($res['policy_name']!==NULL) { return(array('source'=>'Group Policy','policy_name'=>$res['policy_name'],'policy_seconds'=>$res['delete_policy_seconds'])); --- 708,711 ---- *************** *** 733,737 **** // if policy is set in group. If more than one group match, then the group with the longest policy matches. // Individual settings match first. ! $query='select g.bin_delete_policy_individual,d.policy_name,d.delete_policy_seconds from perfdata_host h, perfdata_host_groups gh, perfdata_groups g left join perfdata_delete_policy d on --- 718,722 ---- // if policy is set in group. If more than one group match, then the group with the longest policy matches. // Individual settings match first. ! $query='select d.policy_name,d.delete_policy_seconds from perfdata_host h, perfdata_host_groups gh, perfdata_groups g left join perfdata_delete_policy d on *************** *** 742,745 **** --- 727,731 ---- } print_r($res); + // TODO: not finished?! } |