From 461a30d771edd8bc6606f2c92dfde363514b93b1 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 14 Jun 2013 12:09:08 +0200 Subject: Merge config files (#1487311). Now we have defaults.inc.php and config.inc.php. Renamed $rcmail_config to $config. Old naming and old files are supported for backward compatibility. --- program/lib/Roundcube/rcube_config.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'program') diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php index 18055f77d..ff398bc00 100644 --- a/program/lib/Roundcube/rcube_config.php +++ b/program/lib/Roundcube/rcube_config.php @@ -69,13 +69,19 @@ class rcube_config */ private function load() { + // Load default settings + if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'defaults.inc.php')) { + $this->errors[] = 'defaults.inc.php was not found.'; + } + // load main config file - if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'main.inc.php')) - $this->errors[] = 'main.inc.php was not found.'; + if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'config.inc.php')) { + $this->errors[] = 'config.inc.php was not found.'; - // load database config - if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'db.inc.php')) - $this->errors[] = 'db.inc.php was not found.'; + // Old configuration files + $this->load_from_file(RCUBE_CONFIG_DIR . 'main.inc.php'); + $this->load_from_file(RCUBE_CONFIG_DIR . 'db.inc.php'); + } // load host-specific configuration $this->load_host_config(); @@ -175,7 +181,12 @@ class rcube_config include($fpath); ob_end_clean(); - if (is_array($rcmail_config)) { + if (is_array($config)) { + $this->merge($config); + return true; + } + // deprecated name of config variable + else if (is_array($rcmail_config)) { $this->merge($rcmail_config); return true; } -- cgit v1.2.3 From 0f39b4f4cdd60f4af5f85d656ed08698e86287ea Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Fri, 28 Jun 2013 22:27:30 +0200 Subject: Enable legacy mode: allow running with old config files and log warnings every no and then --- program/lib/Roundcube/rcube_config.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'program') diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php index ff398bc00..90bb85348 100644 --- a/program/lib/Roundcube/rcube_config.php +++ b/program/lib/Roundcube/rcube_config.php @@ -76,11 +76,14 @@ class rcube_config // load main config file if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'config.inc.php')) { - $this->errors[] = 'config.inc.php was not found.'; - // Old configuration files - $this->load_from_file(RCUBE_CONFIG_DIR . 'main.inc.php'); - $this->load_from_file(RCUBE_CONFIG_DIR . 'db.inc.php'); + if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'main.inc.php') || + !$this->load_from_file(RCUBE_CONFIG_DIR . 'db.inc.php')) { + $this->errors[] = 'config.inc.php was not found.'; + } + else if (rand(1,100) == 10) { // log warning on every 100th request (average) + trigger_error("config.inc.php was not found. Please migrate your config by running bin/update.sh", E_USER_WARNING); + } } // load host-specific configuration -- cgit v1.2.3