From 8c72e33d3764cf2695256ab9c2a490d4c4f53696 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Mon, 28 Jul 2008 07:45:35 -0400
Subject: [PATCH] Show appropriate error message if config files are missing
---
program/include/rcube_config.php | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/program/include/rcube_config.php b/program/include/rcube_config.php
index 14316b8..db53fe7 100644
--- a/program/include/rcube_config.php
+++ b/program/include/rcube_config.php
@@ -27,6 +27,7 @@
class rcube_config
{
private $prop = array();
+ private $errors = array();
/**
@@ -50,12 +51,16 @@
ob_start();
// load main config file
- include_once(INSTALL_PATH . 'config/main.inc.php');
- $this->prop = (array)$rcmail_config;
+ if (include(INSTALL_PATH . 'config/main.inc.php'))
+ $this->prop = (array)$rcmail_config;
+ else
+ $this->errors[] = 'main.inc.php was not found.';
// load database config
- include_once(INSTALL_PATH . 'config/db.inc.php');
- $this->prop += (array)$rcmail_config;
+ if (include(INSTALL_PATH . 'config/db.inc.php'))
+ $this->prop += (array)$rcmail_config;
+ else
+ $this->errors[] = 'db.inc.php was not found.';
// load host-specific configuration
$this->load_host_config();
@@ -222,6 +227,17 @@
return $domain;
}
+
+
+ /**
+ * Getter for error state
+ *
+ * @return mixed Error message on error, False if no errors
+ */
+ public function get_error()
+ {
+ return empty($this->errors) ? false : join("\n", $this->errors);
+ }
}
--
Gitblit v1.9.1