summaryrefslogtreecommitdiffstats
path: root/lib/db.php
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2013-01-21 14:57:33 +0100
committerThomas Mueller <thomas.mueller@tmit.eu>2013-01-21 14:57:33 +0100
commitd58cee2f7651a2a8cc9ef75a28f54883e2e01a67 (patch)
treeb7a13d2639a736897566b66f77444ccdff7b1311 /lib/db.php
parent2012603b74eac491a86563787d21638647533147 (diff)
downloadnextcloud-server-d58cee2f7651a2a8cc9ef75a28f54883e2e01a67.tar.gz
nextcloud-server-d58cee2f7651a2a8cc9ef75a28f54883e2e01a67.zip
returning http status code 503 in case connecting to the database failed
Diffstat (limited to 'lib/db.php')
-rw-r--r--lib/db.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/db.php b/lib/db.php
index fbefb13a95e..756901d8643 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -182,6 +182,10 @@ class OC_DB {
self::$PDO=new PDO($dsn, $user, $pass, $opts);
}catch(PDOException $e) {
OC_User::setUserId(null);
+
+ // send http status 503
+ header('HTTP/1.1 503 Service Temporarily Unavailable');
+ header('Status: 503 Service Temporarily Unavailable');
OC_Template::printErrorPage('Failed to connect to '.$type.' database. ('.$e->getMessage().')' );
die();
}
@@ -280,6 +284,10 @@ class OC_DB {
OC_Log::write('core', self::$MDB2->getUserInfo(), OC_Log::FATAL);
OC_Log::write('core', self::$MDB2->getMessage(), OC_Log::FATAL);
OC_User::setUserId(null);
+
+ // send http status 503
+ header('HTTP/1.1 503 Service Temporarily Unavailable');
+ header('Status: 503 Service Temporarily Unavailable');
OC_Template::printErrorPage('Failed to connect to '.$type.' database. ('.self::$MDB2->getUserInfo().')' );
die();
}