From 547b5634646b0556462233f8cac37a41d63a44fb Mon Sep 17 00:00:00 2001 From: kondou Date: Wed, 12 Mar 2014 15:20:51 +0100 Subject: [PATCH 1/4] 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 987a866e49b..891c2eb5fa1 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 44ca421328b..f8bc78ee8e2 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 42477bfc1ca..bbb494a0f8b 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 a47e7bf6563..37c2c47ed20 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 8f786ba76ef..a2775439cae 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; ?> +

+
From c5440fa13305799e1af663993220d200373efc4e Mon Sep 17 00:00:00 2001 From: kondou Date: Wed, 12 Mar 2014 17:29:26 +0100 Subject: [PATCH 2/4] Move cron status to the right of the heading --- settings/css/settings.css | 4 ++++ settings/templates/admin.php | 36 ++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/settings/css/settings.css b/settings/css/settings.css index 37c2c47ed20..249ee1949f0 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -167,6 +167,10 @@ table.shareAPI td { padding-bottom: 0.8em; } width: 40px; } +.cronlog { + margin-left: 10px; +} + .cronstatus { display: inline-block; height: 16px; diff --git a/settings/templates/admin.php b/settings/templates/admin.php index a2775439cae..08a0a8f5e68 100644 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -153,7 +153,24 @@ if (!$_['internetconnectionworking']) { ;?>
-

t('Cron'));?>

+

t('Cron'));?>

+ +

+ + + 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; ?> +

+

Cron
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; ?> -

-
From 556c6eca2397eaa03c4503822d647c8b6cb5e70e Mon Sep 17 00:00:00 2001 From: kondou Date: Wed, 12 Mar 2014 17:53:39 +0100 Subject: [PATCH 3/4] Use OC_Util::formatDate() --- settings/templates/admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings/templates/admin.php b/settings/templates/admin.php index 08a0a8f5e68..bb402f9f78e 100644 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -157,7 +157,7 @@ if (!$_['internetconnectionworking']) {

t("Last cron was executed at %s.", array($human_time))); From e6b4d28229da406b621da61183568a6a1de11cd7 Mon Sep 17 00:00:00 2001 From: kondou Date: Fri, 21 Mar 2014 20:27:22 +0100 Subject: [PATCH 4/4] Move success/error squircles to settings --- apps/files_external/css/settings.css | 7 ------- settings/css/settings.css | 9 +++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/files_external/css/settings.css b/apps/files_external/css/settings.css index 11aeb10184b..1d3489f7f57 100644 --- a/apps/files_external/css/settings.css +++ b/apps/files_external/css/settings.css @@ -4,13 +4,6 @@ td.status > span { width: 16px; vertical-align: text-bottom; } -span.success { - background: #37ce02; - border-radius: 8px; -} -span.error { - background: #ce3702; -} td.mountPoint, td.backend { width:160px; } td.remove>img { visibility:hidden; padding-top:13px; } diff --git a/settings/css/settings.css b/settings/css/settings.css index 249ee1949f0..280d022af4e 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -178,6 +178,15 @@ table.shareAPI td { padding-bottom: 0.8em; } vertical-align: text-bottom; } +span.success { + background: #37ce02; + border-radius: 8px; +} + +span.error { + background: #ce3702; +} + /* HELP */ .pressed {background-color:#DDD;}