summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-03-25 19:17:36 +0100
committerVincent Petry <pvince81@owncloud.com>2014-03-25 19:17:36 +0100
commit5111fad006a7a1e7beb18017bc63b307478a4881 (patch)
treed68b866fd4cc823af27511d6959366755e6e0b36
parent36c9d91f86bc893f1f2d782b1aa3e314cda7f3a2 (diff)
parente6b4d28229da406b621da61183568a6a1de11cd7 (diff)
downloadnextcloud-server-5111fad006a7a1e7beb18017bc63b307478a4881.tar.gz
nextcloud-server-5111fad006a7a1e7beb18017bc63b307478a4881.zip
Merge pull request #7689 from owncloud/last_cron_log
Log last cron execution
-rw-r--r--apps/files_external/css/settings.css7
-rwxr-xr-xconfig/config.sample.php3
-rw-r--r--cron.php4
-rwxr-xr-xsettings/admin.php2
-rw-r--r--settings/css/settings.css20
-rw-r--r--settings/templates/admin.php19
6 files changed, 47 insertions, 8 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/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 a0447f97f19..05d47124da0 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 80b038d2ef6..23b3a2d5a0e 100755
--- a/settings/admin.php
+++ b/settings/admin.php
@@ -45,6 +45,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..280d022af4e 100644
--- a/settings/css/settings.css
+++ b/settings/css/settings.css
@@ -167,6 +167,26 @@ table.shareAPI td { padding-bottom: 0.8em; }
width: 40px;
}
+.cronlog {
+ margin-left: 10px;
+}
+
+.cronstatus {
+ display: inline-block;
+ height: 16px;
+ width: 16px;
+ vertical-align: text-bottom;
+}
+
+span.success {
+ background: #37ce02;
+ border-radius: 8px;
+}
+
+span.error {
+ background: #ce3702;
+}
+
/* HELP */
.pressed {background-color:#DDD;}
diff --git a/settings/templates/admin.php b/settings/templates/admin.php
index 6e816c1fff6..9092d2833fd 100644
--- a/settings/templates/admin.php
+++ b/settings/templates/admin.php
@@ -157,7 +157,24 @@ if (!$_['internetconnectionworking']) {
;?>
<fieldset class="personalblock" id="backgroundjobs">
- <h2><?php p($l->t('Cron'));?></h2>
+ <h2 class="inlineblock"><?php p($l->t('Cron'));?></h2>
+ <?php if ($_['cron_log']): ?>
+ <p class="cronlog inlineblock">
+ <?php if ($_['lastcron'] !== false):
+ $human_time = OC_Util::formatDate($_['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; ?>
<p>
<input type="radio" name="mode" value="ajax"
id="backgroundjobs_ajax" <?php if ($_['backgroundjobs_mode'] === "ajax") {