From 547b5634646b0556462233f8cac37a41d63a44fb Mon Sep 17 00:00:00 2001 From: kondou Date: Wed, 12 Mar 2014 15:20:51 +0100 Subject: [PATCH] Log last cron execution Fixes #2012 --- config/config.sample.php | 3 +++ cron.php | 4 ++++ settings/admin.php | 2 ++ settings/css/settings.css | 7 +++++++ settings/templates/admin.php | 17 +++++++++++++++++ 5 files changed, 33 insertions(+) diff --git a/config/config.sample.php b/config/config.sample.php index 987a866e49..891c2eb5fa 100755 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -178,6 +178,9 @@ $CONFIG = array( /* Enable or disable the logging of IP addresses in case of webform auth failures */ "log_authfailip" => false, +/* Whether ownCloud should log the last successfull cron exec */ +"cron_log" => true, + /* Whether http-basic username must equal username to login */ "basic_auth" => true, diff --git a/cron.php b/cron.php index 44ca421328..f8bc78ee8e 100644 --- a/cron.php +++ b/cron.php @@ -119,6 +119,10 @@ try { // done! TemporaryCronClass::$sent = true; + // Log the successfull cron exec + if (OC_Config::getValue('cron_log', true)) { + OC_Appconfig::setValue('core', 'lastcron', time()); + } exit(); } catch (Exception $ex) { diff --git a/settings/admin.php b/settings/admin.php index 42477bfc1c..bbb494a0f8 100755 --- a/settings/admin.php +++ b/settings/admin.php @@ -40,6 +40,8 @@ $tmpl->assign('isWebDavWorking', OC_Util::isWebDAVWorking()); $tmpl->assign('has_fileinfo', OC_Util::fileInfoLoaded()); $tmpl->assign('old_php', OC_Util::isPHPoutdated()); $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')); // Check if connected using HTTPS diff --git a/settings/css/settings.css b/settings/css/settings.css index a47e7bf656..37c2c47ed2 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -167,6 +167,13 @@ table.shareAPI td { padding-bottom: 0.8em; } width: 40px; } +.cronstatus { + display: inline-block; + height: 16px; + width: 16px; + vertical-align: text-bottom; +} + /* HELP */ .pressed {background-color:#DDD;} diff --git a/settings/templates/admin.php b/settings/templates/admin.php index 8f786ba76e..a2775439ca 100644 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -178,6 +178,23 @@ if (!$_['internetconnectionworking']) {
t("Use systems cron service to call the cron.php file every 15 minutes.")); ?>

+ +

+ + + t("Last cron was executed at %s.", array($human_time))); + else: ?> + + t("Last cron was executed at %s. This is more than an hour ago, something seems wrong.", array($human_time))); + endif; + else: ?> + + t("Cron was not executed yet!")); + endif; ?> +

+