From e56633d5b0009fd5430a15fd09633e8f43bdb7dd Mon Sep 17 00:00:00 2001 From: ken restivo Date: Thu, 19 Nov 2015 20:58:13 -0800 Subject: Throw HTTP error and display error message when database is unavailable. #179 --- index.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'index.php') diff --git a/index.php b/index.php index 3758b38b0..dc6000bd6 100755 --- a/index.php +++ b/index.php @@ -36,6 +36,12 @@ require_once('include/dba/dba_driver.php'); if(! $a->install) { $db = dba_factory($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type, $a->install); + if(! $db->connected){ + header('HTTP/1.0 520 Unknown Error'); + // TODO: much friendlier error message + die("Database error, contact admin."); + } + unset($db_host, $db_port, $db_user, $db_pass, $db_data, $db_type); /** -- cgit v1.2.3