Skip to content
Snippets Groups Projects
Commit 4009f152 authored by Morris Jobke's avatar Morris Jobke
Browse files

Merge pull request #14593 from owncloud/fix/13994

Add detection for invalid CLI configuration for settings page
parents 7194952d afb0d742
Branches
No related tags found
No related merge requests found
...@@ -575,16 +575,31 @@ class OC { ...@@ -575,16 +575,31 @@ class OC {
$errors = OC_Util::checkServer(\OC::$server->getConfig()); $errors = OC_Util::checkServer(\OC::$server->getConfig());
if (count($errors) > 0) { if (count($errors) > 0) {
if (self::$CLI) { if (self::$CLI) {
// Convert l10n string into regular string for usage in database
$staticErrors = [];
foreach ($errors as $error) { foreach ($errors as $error) {
echo $error['error'] . "\n"; echo $error['error'] . "\n";
echo $error['hint'] . "\n\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();
} else { } else {
OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
OC_Template::printGuestPage('', 'error', array('errors' => $errors)); OC_Template::printGuestPage('', 'error', array('errors' => $errors));
}
exit; exit;
} }
} elseif(self::$CLI && \OC::$server->getConfig()->getSystemValue('installed', false)) {
\OC::$server->getConfig()->deleteAppValue('core', 'cronErrors');
}
//try to set the session lifetime //try to set the session lifetime
$sessionLifeTime = self::getSessionLifeTime(); $sessionLifeTime = self::getSessionLifeTime();
......
...@@ -80,6 +80,7 @@ $template->assign('allowMailNotification', $appConfig->getValue('core', 'shareap ...@@ -80,6 +80,7 @@ $template->assign('allowMailNotification', $appConfig->getValue('core', 'shareap
$template->assign('onlyShareWithGroupMembers', \OC\Share\Share::shareWithGroupMembersOnly()); $template->assign('onlyShareWithGroupMembers', \OC\Share\Share::shareWithGroupMembersOnly());
$databaseOverload = (strpos(\OCP\Config::getSystemValue('dbtype'), 'sqlite') !== false); $databaseOverload = (strpos(\OCP\Config::getSystemValue('dbtype'), 'sqlite') !== false);
$template->assign('databaseOverload', $databaseOverload); $template->assign('databaseOverload', $databaseOverload);
$template->assign('cronErrors', $appConfig->getValue('core', 'cronErrors'));
// warn if Windows is used // warn if Windows is used
$template->assign('WindowsWarning', OC_Util::runningOnWindows()); $template->assign('WindowsWarning', OC_Util::runningOnWindows());
......
...@@ -212,7 +212,29 @@ if ($_['suggestedOverwriteCliUrl']) { ...@@ -212,7 +212,29 @@ if ($_['suggestedOverwriteCliUrl']) {
</div> </div>
<?php <?php
} }
if ($_['cronErrors']) {
?> ?>
<div class="section">
<h2><?php p($l->t('Cronjob encountered misconfiguration'));?></h2>
<span class="connectionwarning">
<?php p($l->t('It was not possible to execute the cronjob via CLI. The following technical errors have appeared:')); ?>
<br/>
<ol>
<?php foreach(json_decode($_['cronErrors']) as $error) { if(isset($error->error)) {?>
<li><?php p($error->error) ?></li>
<ul><li><?php p($error->hint) ?></li></ul>
<?php }};?>
</ol>
</span>
</div>
<?php
}
?>
<div id="postsetupchecks" class="section"> <div id="postsetupchecks" class="section">
<h2><?php p($l->t('Configuration Checks'));?></h2> <h2><?php p($l->t('Configuration Checks'));?></h2>
<div class="loading"></div> <div class="loading"></div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment