Merge pull request #1113 from owncloud/fix-issue-1085
Fix rendering of database connection error page
This commit is contained in:
commit
9eecb91338
|
@ -88,7 +88,7 @@ var OC={
|
|||
PERMISSION_DELETE:8,
|
||||
PERMISSION_SHARE:16,
|
||||
webroot:oc_webroot,
|
||||
appswebroots:oc_appswebroots,
|
||||
appswebroots:(typeof oc_appswebroots !== 'undefined') ? oc_appswebroots:false,
|
||||
currentUser:(typeof oc_current_user!=='undefined')?oc_current_user:false,
|
||||
coreApps:['', 'admin','log','search','settings','core','3rdparty'],
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
<script type="text/javascript">
|
||||
var oc_debug = <?php echo (defined('DEBUG') && DEBUG) ? 'true' : 'false'; ?>;
|
||||
var oc_webroot = '<?php echo OC::$WEBROOT; ?>';
|
||||
var oc_appswebroots = <?php echo $_['apps_paths'] ?>;
|
||||
var oc_requesttoken = '<?php echo $_['requesttoken']; ?>';
|
||||
</script>
|
||||
<?php foreach ($_['jsfiles'] as $jsfile): ?>
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
<script type="text/javascript">
|
||||
var oc_debug = <?php echo (defined('DEBUG') && DEBUG) ? 'true' : 'false'; ?>;
|
||||
var oc_webroot = '<?php echo OC::$WEBROOT; ?>';
|
||||
var oc_appswebroots = <?php echo $_['apps_paths'] ?>;
|
||||
var oc_requesttoken = '<?php echo $_['requesttoken']; ?>';
|
||||
var datepickerFormatDate = <?php echo json_encode($l->l('jsdate', 'jsdate')) ?>;
|
||||
var dayNames = <?php echo json_encode(array((string)$l->t('Sunday'), (string)$l->t('Monday'), (string)$l->t('Tuesday'), (string)$l->t('Wednesday'), (string)$l->t('Thursday'), (string)$l->t('Friday'), (string)$l->t('Saturday'))) ?>;
|
||||
|
|
17
lib/db.php
17
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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue