Changeset 5851

Show
Ignore:
Timestamp:
07/23/08 17:18:26 (2 months ago)
Author:
shotamchay
Message:

this fixes the infinite looping process

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/centreon/www/include/configuration/configObject/host/DB-Func.php

    r5850 r5851  
    661661         *      this function cleans all the services that were linked to the removed host template   
    662662         */ 
    663         function deleteHostServiceMultiTemplate($hID, $scndHID, $host_list){ 
     663        function deleteHostServiceMultiTemplate($hID, $scndHID, $host_list, $antiLoop = NULL){ 
    664664                global $pearDB, $path, $oreon; 
    665665         
     666                if (isset($antiLoop[$scndHID]) && $antiLoop[$scndHID]) { 
     667                        return 0; 
     668                } 
    666669                $DBRESULT3 =& $pearDB->query("SELECT service_service_id " . 
    667670                                                                "FROM `service` svc, `host_service_relation` hsr " . 
     
    710713                                        print "DB Error : ".$DBRESULT4->getDebugInfo()."<br />"; 
    711714                        } 
    712                         deleteHostServiceMultiTemplate($hID, $result["host_tpl_id"], $host_list); 
     715                        $antiLoop[$scndHID] = 1; 
     716                        deleteHostServiceMultiTemplate($hID, $result["host_tpl_id"], $host_list, $antiLoop); 
    713717                }        
    714718        } 
     
    13701374        } 
    13711375 
    1372 function generateHostServiceMultiTemplate($hID, $hID2 = NULL){ 
     1376function generateHostServiceMultiTemplate($hID, $hID2 = NULL, $antiLoop = NULL){ 
    13731377        global $pearDB, $path, $oreon; 
    13741378         
     1379        if (isset($antiLoop[$hID2]) && $antiLoop[$hID2]) {               
     1380                return 0;        
     1381        } 
    13751382        $rq = "SELECT host_tpl_id FROM `host_template_relation` WHERE host_host_id = " . $hID2; 
    13761383        $DBRESULT =& $pearDB->query($rq); 
     
    13941401                        } 
    13951402                } 
    1396                 generateHostServiceMultiTemplate($hID, $hTpl['host_tpl_id']); 
     1403                $antiLoop[$hID2] = 1; 
     1404                generateHostServiceMultiTemplate($hID, $hTpl['host_tpl_id'], $antiLoop); 
    13971405        } 
    13981406}