diff options
author | Björn Schießle <schiessle@owncloud.com> | 2013-01-28 11:18:04 +0100 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2013-01-28 11:18:04 +0100 |
commit | 8067a1394e3dab551e65ec8abd12e673a811bf40 (patch) | |
tree | fd18fac68c7ca62ee50142e771f0da70a9c0925d /lib/db.php | |
parent | dbb0d0407324830f4a7ff51781c535c1cb0d2a06 (diff) | |
parent | 857b15db3739fe8fbbad4df0f10e9b48ba1f90c2 (diff) | |
download | nextcloud-server-8067a1394e3dab551e65ec8abd12e673a811bf40.tar.gz nextcloud-server-8067a1394e3dab551e65ec8abd12e673a811bf40.zip |
fix merge conflicts
Diffstat (limited to 'lib/db.php')
-rw-r--r-- | lib/db.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/db.php b/lib/db.php index 7cc65673d10..51f7c7679d4 100644 --- a/lib/db.php +++ b/lib/db.php @@ -184,7 +184,14 @@ class OC_DB { try{ self::$PDO=new PDO($dsn, $user, $pass, $opts); }catch(PDOException $e) { - OC_Template::printErrorPage( 'can not connect to database, using '.$type.'. ('.$e->getMessage().')' ); + OC_Log::write('core', $e->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 database'); + die(); } // We always, really always want associative arrays self::$PDO->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); @@ -281,7 +288,13 @@ class OC_DB { if( PEAR::isError( self::$MDB2 )) { OC_Log::write('core', self::$MDB2->getUserInfo(), OC_Log::FATAL); OC_Log::write('core', self::$MDB2->getMessage(), OC_Log::FATAL); - OC_Template::printErrorPage( 'can not connect to database, using '.$type.'. ('.self::$MDB2->getUserInfo().')' ); + 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 database'); + die(); } // We always, really always want associative arrays |