Changeset 6702

Show
Ignore:
Timestamp:
10/03/08 10:59:19 (2 months ago)
Author:
jmathis
Message:

fixe bug #251

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/centreon-2.0/www/include/configuration/configGenerate/formGenerateFiles.php

    r6530 r6702  
    2727        } 
    2828 
    29         # Get Poller List 
     29        /* 
     30         *  Get Poller List 
     31         */ 
    3032        $DBRESULT =& $pearDB->query("SELECT * FROM `nagios_server` WHERE `ns_activate` = '1' ORDER BY `localhost` DESC"); 
    3133        if (PEAR::isError($DBRESULT)) 
    3234                print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
    33         if ($DBRESULT->numRows() > 1) { 
     35        $n = $DBRESULT->numRows(); 
     36        /* 
     37         * Display null option 
     38         */ 
     39        if ($n > 1) 
    3440                $tab_nagios_server = array(NULL => ""); 
    35                 $tab_nagios_server[0] = _("All Nagios Servers"); 
    36         } 
     41        /* 
     42         * Display all servers list 
     43         */ 
    3744        for ($i = 0; $nagios =& $DBRESULT->fetchRow(); $i++) 
    3845                $tab_nagios_server[$nagios['id']] = $nagios['name']; 
     46        $DBRESULT->free(); 
     47        /* 
     48         * Display all server options 
     49         */ 
     50        if ($n > 1) 
     51                $tab_nagios_server[0] = _("All Nagios Servers"); 
    3952         
    4053        /* 
     
    88101                                $host_list[$key] = $value; 
    89102 
    90                 if (isset($ret["gen"]) && $ret["gen"] && $ret["host"]){ 
     103                if (isset($ret["gen"]) && $ret["gen"] && ($ret["host"] == 0 || $ret["host"])){ 
    91104                        /* 
    92105                         * Check dependancies 
     
    97110                                print "DB Error : ".$DBRESULT_Servers->getDebugInfo()."<br />"; 
    98111                        while ($tab =& $DBRESULT_Servers->fetchRow()){ 
    99                                 if (isset($ret["host"]) && $ret["host"] == 0 || $ret["host"] == $tab['id']){     
     112                                if (isset($ret["host"]) && $ret["host"] == 0 || $ret["host"] == $tab['id']){ 
    100113                                        unset($DBRESULT2); 
    101                                         require($path."genCGICFG.php"); 
    102                                         require($path."genNagiosCFG.php"); 
    103                                         require($path."genNdomod.php"); 
    104                                         require($path."genNdo2db.php"); 
    105                                         require($path."genNagiosCFG-DEBUG.php"); 
    106                                         require($path."genResourceCFG.php"); 
    107                                         require($path."genTimeperiods.php"); 
    108                                         require($path."genCommands.php"); 
    109                                         require($path."genContacts.php"); 
    110                                         require($path."genContactGroups.php"); 
    111                                         require($path."genHosts.php"); 
    112                                         require($path."genExtendedInfos.php"); 
    113                                         require($path."genHostGroups.php"); 
    114                                         require($path."genServices.php"); 
    115                                         require($path."genServiceGroups.php"); 
    116                                         require($path."genEscalations.php"); 
    117                                         require($path."genDependencies.php"); 
    118                                         require($path."centreon_pm.php"); 
     114                                        require $path."genCGICFG.php"; 
     115                                        require $path."genNagiosCFG.php"; 
     116                                        require $path."genNdomod.php"; 
     117                                        require $path."genNdo2db.php"; 
     118                                        require $path."genNagiosCFG-DEBUG.php"; 
     119                                        require $path."genResourceCFG.php"; 
     120                                        require $path."genTimeperiods.php"; 
     121                                        require $path."genCommands.php"; 
     122                                        require $path."genContacts.php"; 
     123                                        require $path."genContactGroups.php"; 
     124                                        require $path."genHosts.php"; 
     125                                        require $path."genExtendedInfos.php"; 
     126                                        require $path."genHostGroups.php"; 
     127                                        require $path."genServices.php"; 
     128                                        require $path."genServiceGroups.php"; 
     129                                        require $path."genEscalations.php"; 
     130                                        require $path."genDependencies.php"; 
     131                                        require $path."centreon_pm.php"; 
    119132                                } 
    120133                                unset($generatedHG); 
     
    122135                                unset($generatedS); 
    123136                        } 
    124                 }                        
     137                } 
     138                                         
    125139                /* 
    126140                 * Meta Module Generator engine 
    127141                 */ 
     142                  
    128143                $DBRESULT_Servers =& $pearDB->query("SELECT `id`, `localhost` FROM `nagios_server` ORDER BY `localhost` DESC"); 
    129144                if (PEAR::isError($DBRESULT_Servers)) 
     
    212227                                        } 
    213228                                } else { 
    214                                         passthru ("echo 'SENDCFGFILE:".$host['id']."' >> @CENTREON_VARLIB@/centcore.cmd", $return); 
     229                                        passthru("echo 'SENDCFGFILE:".$host['id']."' >> @CENTREON_VARLIB@/centcore.cmd", $return); 
    215230                                } 
    216231                }