summaryrefslogtreecommitdiff
path: root/program/lib/Roundcube/rcube_config.php
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2013-07-10 22:49:12 +0200
committerThomas Bruederli <thomas@roundcube.net>2013-07-10 22:49:12 +0200
commit0703bfecd0b9efca36caee4f7b9c64c4135d57af (patch)
tree98316de8bbc1da023b7da5863188171f08e6614e /program/lib/Roundcube/rcube_config.php
parentbd284693027196517545616883d5cc43a3f0d39e (diff)
parentdee0aff85a7f2e5b16cf77835ac56a5ef2e4f1b7 (diff)
Merged configuration refactoring from 'dev_config' branch back into master (#1487311)
Diffstat (limited to 'program/lib/Roundcube/rcube_config.php')
-rw-r--r--program/lib/Roundcube/rcube_config.php28
1 files changed, 21 insertions, 7 deletions
diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php
index 18055f77d..90bb85348 100644
--- a/program/lib/Roundcube/rcube_config.php
+++ b/program/lib/Roundcube/rcube_config.php
@@ -69,13 +69,22 @@ class rcube_config
*/
private function load()
{
- // load main config file
- if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'main.inc.php'))
- $this->errors[] = 'main.inc.php was not found.';
+ // Load default settings
+ if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'defaults.inc.php')) {
+ $this->errors[] = 'defaults.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.';
+ // load main config file
+ if (!$this->load_from_file(RCUBE_CONFIG_DIR . 'config.inc.php')) {
+ // Old configuration files
+ 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
$this->load_host_config();
@@ -175,7 +184,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;
}