From 18d2e6efcdabe2e9cf09874644fd20d80e2edb68 Mon Sep 17 00:00:00 2001 From: Davide Franco Date: Mon, 6 Jun 2011 17:52:50 +0200 Subject: [PATCH] bacula-web: bug fix with config file existence check - changed the way of checking if the config file exist and/or is readable --- gui/bacula-web/config.inc.php | 1 - gui/bacula-web/includes/bweb.inc.php | 10 +++------- gui/bacula-web/includes/cfg/config.class.php | 5 +++++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gui/bacula-web/config.inc.php b/gui/bacula-web/config.inc.php index e5c8d08665..a20d732e57 100644 --- a/gui/bacula-web/config.inc.php +++ b/gui/bacula-web/config.inc.php @@ -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 ); diff --git a/gui/bacula-web/includes/bweb.inc.php b/gui/bacula-web/includes/bweb.inc.php index 1200d1250c..f2a091f33d 100644 --- a/gui/bacula-web/includes/bweb.inc.php +++ b/gui/bacula-web/includes/bweb.inc.php @@ -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'] ) ) diff --git a/gui/bacula-web/includes/cfg/config.class.php b/gui/bacula-web/includes/cfg/config.class.php index 9cdd204f79..480874b25b 100644 --- a/gui/bacula-web/includes/cfg/config.class.php +++ b/gui/bacula-web/includes/cfg/config.class.php @@ -36,6 +36,11 @@ { 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 ) -- 2.39.5