summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/db.php17
-rw-r--r--lib/setup.php4
-rw-r--r--lib/templatelayout.php17
3 files changed, 23 insertions, 15 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
diff --git a/lib/setup.php b/lib/setup.php
index 28882b6bede..4dd190b99fb 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -165,7 +165,9 @@ class OC_Setup {
if(count($error) == 0) {
OC_Appconfig::setValue('core', 'installedat', microtime(true));
OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true));
-
+ OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php');
+ OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php');
+
OC_Group::createGroup('admin');
OC_Group::addToGroup($username, 'admin');
OC_User::login($username, $password);
diff --git a/lib/templatelayout.php b/lib/templatelayout.php
index 4173e008ba7..83d36199986 100644
--- a/lib/templatelayout.php
+++ b/lib/templatelayout.php
@@ -28,23 +28,16 @@ class OC_TemplateLayout extends OC_Template {
break;
}
}
+ $apps_paths = array();
+ foreach(OC_App::getEnabledApps() as $app) {
+ $apps_paths[$app] = OC_App::getAppWebPath($app);
+ }
+ $this->assign( 'apps_paths', str_replace('\\/', '/', json_encode($apps_paths)), false ); // Ugly unescape slashes waiting for better solution
} else if ($renderas == 'guest') {
parent::__construct('core', 'layout.guest');
} else {
parent::__construct('core', 'layout.base');
}
-
- $apps_paths = array();
- foreach(OC_App::getEnabledApps() as $app) {
- $apps_paths[$app] = OC_App::getAppWebPath($app);
- }
- $this->assign( 'apps_paths', str_replace('\\/', '/', json_encode($apps_paths)), false ); // Ugly unescape slashes waiting for better solution
-
- if (OC_Config::getValue('installed', false) && !OC_AppConfig::getValue('core', 'remote_core.css', false)) {
- OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php');
- OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php');
- }
-
// Add the js files
$jsfiles = self::findJavascriptFiles(OC_Util::$scripts);
$this->assign('jsfiles', array(), false);