Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 25 additions & 20 deletions lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -652,30 +652,35 @@ public static function init() {
if (!defined('OC_CONSOLE')) {
$errors = OC_Util::checkServer(\OC::$server->getSystemConfig());
if (count($errors) > 0) {
if (self::$CLI) {
// Convert l10n string into regular string for usage in database
$staticErrors = [];
foreach ($errors as $error) {
echo $error['error'] . "\n";
echo $error['hint'] . "\n\n";
$staticErrors[] = [
'error' => (string)$error['error'],
'hint' => (string)$error['hint'],
];
}

if (!self::$CLI) {
http_response_code(503);
OC_Util::addStyle('guest');
try {
\OC::$server->getConfig()->setAppValue('core', 'cronErrors', json_encode($staticErrors));
OC_Template::printGuestPage('', 'error', array('errors' => $errors));
exit;
} catch (\Exception $e) {
echo('Writing to database failed');
// In case any error happens when showing the error page, we simply fall back to posting the text.
// This might be the case when e.g. the data directory is broken and we can not load/write SCSS to/from it.
}
exit(1);
} else {
http_response_code(503);
OC_Util::addStyle('guest');
OC_Template::printGuestPage('', 'error', array('errors' => $errors));
exit;
}

// Convert l10n string into regular string for usage in database
$staticErrors = [];
foreach ($errors as $error) {
echo $error['error'] . "\n";
echo $error['hint'] . "\n\n";
$staticErrors[] = [
'error' => (string)$error['error'],
'hint' => (string)$error['hint'],
];
}

try {
\OC::$server->getConfig()->setAppValue('core', 'cronErrors', json_encode($staticErrors));
} catch (\Exception $e) {
echo('Writing to database failed');
}
exit(1);
} elseif (self::$CLI && \OC::$server->getConfig()->getSystemValue('installed', false)) {
\OC::$server->getConfig()->deleteAppValue('core', 'cronErrors');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/legacy/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public static function printAdminPage( $application, $name, $parameters = array(
* @return bool
*/
public static function printGuestPage( $application, $name, $parameters = array() ) {
$content = new OC_Template( $application, $name, "guest" );
$content = new OC_Template($application, $name, $name === 'error' ? $name : 'guest');
foreach( $parameters as $key => $value ) {
$content->assign( $key, $value );
}
Expand Down