Skip to content
Snippets Groups Projects
Commit d58cee2f authored by Thomas Müller's avatar Thomas Müller
Browse files

returning http status code 503 in case connecting to the database failed

parent 2012603b
Branches
No related tags found
No related merge requests found
......@@ -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();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment