Log last cron execution

Fixes #2012
This commit is contained in:
kondou 2014-03-12 15:20:51 +01:00
parent ce790119ae
commit 547b563464
5 changed files with 33 additions and 0 deletions

View File

@ -178,6 +178,9 @@ $CONFIG = array(
/* Enable or disable the logging of IP addresses in case of webform auth failures */ /* Enable or disable the logging of IP addresses in case of webform auth failures */
"log_authfailip" => false, "log_authfailip" => false,
/* Whether ownCloud should log the last successfull cron exec */
"cron_log" => true,
/* Whether http-basic username must equal username to login */ /* Whether http-basic username must equal username to login */
"basic_auth" => true, "basic_auth" => true,

View File

@ -119,6 +119,10 @@ try {
// done! // done!
TemporaryCronClass::$sent = true; TemporaryCronClass::$sent = true;
// Log the successfull cron exec
if (OC_Config::getValue('cron_log', true)) {
OC_Appconfig::setValue('core', 'lastcron', time());
}
exit(); exit();
} catch (Exception $ex) { } catch (Exception $ex) {

View File

@ -40,6 +40,8 @@ $tmpl->assign('isWebDavWorking', OC_Util::isWebDAVWorking());
$tmpl->assign('has_fileinfo', OC_Util::fileInfoLoaded()); $tmpl->assign('has_fileinfo', OC_Util::fileInfoLoaded());
$tmpl->assign('old_php', OC_Util::isPHPoutdated()); $tmpl->assign('old_php', OC_Util::isPHPoutdated());
$tmpl->assign('backgroundjobs_mode', OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax')); $tmpl->assign('backgroundjobs_mode', OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax'));
$tmpl->assign('cron_log', OC_Config::getValue('cron_log', true));
$tmpl->assign('lastcron', OC_Appconfig::getValue('core', 'lastcron', false));
$tmpl->assign('shareAPIEnabled', OC_Appconfig::getValue('core', 'shareapi_enabled', 'yes')); $tmpl->assign('shareAPIEnabled', OC_Appconfig::getValue('core', 'shareapi_enabled', 'yes'));
// Check if connected using HTTPS // Check if connected using HTTPS

View File

@ -167,6 +167,13 @@ table.shareAPI td { padding-bottom: 0.8em; }
width: 40px; width: 40px;
} }
.cronstatus {
display: inline-block;
height: 16px;
width: 16px;
vertical-align: text-bottom;
}
/* HELP */ /* HELP */
.pressed {background-color:#DDD;} .pressed {background-color:#DDD;}

View File

@ -178,6 +178,23 @@ if (!$_['internetconnectionworking']) {
<label for="backgroundjobs_cron">Cron</label><br/> <label for="backgroundjobs_cron">Cron</label><br/>
<em><?php p($l->t("Use systems cron service to call the cron.php file every 15 minutes.")); ?></em> <em><?php p($l->t("Use systems cron service to call the cron.php file every 15 minutes.")); ?></em>
</p> </p>
<?php if ($_['cron_log']): ?>
<p>
<?php if ($_['lastcron'] !== false):
$human_time = date('Y-m-d H:i', $_['lastcron']) . " UTC";
if (time() - $_['lastcron'] <= 3600): ?>
<span class="cronstatus success"></span>
<?php p($l->t("Last cron was executed at %s.", array($human_time)));
else: ?>
<span class="cronstatus error"></span>
<?php p($l->t("Last cron was executed at %s. This is more than an hour ago, something seems wrong.", array($human_time)));
endif;
else: ?>
<span class="cronstatus error"></span>
<?php p($l->t("Cron was not executed yet!"));
endif; ?>
</p>
<?php endif; ?>
</fieldset> </fieldset>
<fieldset class="personalblock" id="shareAPI"> <fieldset class="personalblock" id="shareAPI">