aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorken restivo <ken@restivo.org>2015-11-19 20:58:13 -0800
committerken restivo <ken@restivo.org>2015-11-19 20:58:13 -0800
commite56633d5b0009fd5430a15fd09633e8f43bdb7dd (patch)
treefea3e0bee67d3b1020e3d9c77b204c70d646181f
parenta44795e6c32d90d54e5a4321cad4ffe0f3409a09 (diff)
downloadvolse-hubzilla-e56633d5b0009fd5430a15fd09633e8f43bdb7dd.tar.gz
volse-hubzilla-e56633d5b0009fd5430a15fd09633e8f43bdb7dd.tar.bz2
volse-hubzilla-e56633d5b0009fd5430a15fd09633e8f43bdb7dd.zip
Throw HTTP error and display error message when database is unavailable. #179
-rwxr-xr-xindex.php6
1 files changed, 6 insertions, 0 deletions
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);
/**