]> git.sur5r.net Git - bacula/bacula/commitdiff
bacula-web: bug fix with config file existence check
authorDavide Franco <bacula-dev@dflc.ch>
Mon, 6 Jun 2011 15:52:50 +0000 (17:52 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:49:12 +0000 (14:49 +0200)
 - changed the way of checking if the config file exist and/or is readable

gui/bacula-web/config.inc.php
gui/bacula-web/includes/bweb.inc.php
gui/bacula-web/includes/cfg/config.class.php

index e5c8d08665a5ba631b148a438b1cd1bfb03af645..a20d732e5797fd75bab2a634413cfc91b6764535 100644 (file)
@@ -36,7 +36,6 @@
  // Global constants
  define('CONFIG_DIR', BW_ROOT . "/config/");
  define('CONFIG_FILE', CONFIG_DIR . "config.php");
- require_once( CONFIG_FILE );
  
  // Time intervals in secondes
  define( 'LAST_DAY', 86400 );
index 1200d1250c24e86f50df25b6f1ad604c65317c1d..f2a091f33d93698778016336084609906fc2cf14 100644 (file)
@@ -36,13 +36,9 @@ class Bweb extends DB {
                $this->bwcfg = new BW_Config();
                $dsn = array();
                
-               // Checking if config file exist and is readable
-               if( !$this->bwcfg->Check_Config_File() )
-                       die( "Unable to load configuration file" );
-               else {
-                       $this->bwcfg->Load_Config();
-                       $this->catalog_nb = $this->bwcfg->Count_Catalogs();
-               }
+               // Loading configuration from config file
+               $this->bwcfg->Load_Config();
+               $this->catalog_nb = $this->bwcfg->Count_Catalogs();
                
                // Select which catalog to connect to
                if( isset( $_POST['catalog_id'] ) )
index 9cdd204f79fb339aa3b188af27fb369067a89224..480874b25be2311ed51ead4d18bdf225497dd161 100644 (file)
        {
                global $config;
                
+               if( $this->Check_Config_file() )
+                       include_once( CONFIG_FILE );
+               else
+                       die( "Configuration file not found" );
+               
                if( is_array($config) && !empty($config) ) {
                        // Loading database connection information
                        foreach( $config as $parameter => $value )