From c1d520f1cfd56b0bc44ebccd1acd158a163ef3ed Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 13 Sep 2021 17:40:39 -0600 Subject: [PATCH 1/3] Add date/time to text file output of scheduler --- system/src/Grav/Common/Scheduler/Job.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Scheduler/Job.php b/system/src/Grav/Common/Scheduler/Job.php index f21c26def..94fbaf102 100644 --- a/system/src/Grav/Common/Scheduler/Job.php +++ b/system/src/Grav/Common/Scheduler/Job.php @@ -390,7 +390,9 @@ class Job if (count($this->outputTo) > 0) { foreach ($this->outputTo as $file) { $output_mode = $this->outputMode === 'append' ? FILE_APPEND | LOCK_EX : LOCK_EX; - file_put_contents($file, $this->output, $output_mode); + $timestamp = (new DateTime('now'))->format('c'); + $output = $timestamp . "\n" . str_pad('', strlen($timestamp), '>') . "\n" . $this->output; + file_put_contents($file, $output, $output_mode); } } From 61c2abee356241e723003b1d13f22aa487519a2a Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 13 Sep 2021 17:40:55 -0600 Subject: [PATCH 2/3] use a simple cron text field as custom one was confusing --- system/blueprints/config/scheduler.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system/blueprints/config/scheduler.yaml b/system/blueprints/config/scheduler.yaml index caa771167..a8dce314b 100644 --- a/system/blueprints/config/scheduler.yaml +++ b/system/blueprints/config/scheduler.yaml @@ -47,7 +47,8 @@ form: label: PLUGIN_ADMIN.EXTRA_ARGUMENTS placeholder: '-lah' .at: - type: cron + type: text + wrapper_classes: cron-selector label: PLUGIN_ADMIN.SCHEDULER_RUNAT help: PLUGIN_ADMIN.SCHEDULER_RUNAT_HELP placeholder: '* * * * *' From 34b7a28fbe5e40b7087a18258d97903d388a3b66 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 13 Sep 2021 17:42:30 -0600 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 221b5c1bb..0e69ce852 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ * Added support for `flex-required@: not exists` and `flex-required@: '!exists'` in blueprints * Added `$object->getOriginalData()` to get flex objects data before it was modified with `update()` * Throwing exceptions from Twig templates fires `onDisplayErrorPage.[code]` event allowing better error pages +2. [](#improved) + * Use a simplified text-based `cron` field for scheduler + * Add timestamp to logging output of scheduler jobs to see when they ran 3. [](#bugfix) * Fixed escaping in PageIndex::getLevelListing() * Fixed validation of `number` type [#3433](https://github.com/getgrav/grav/issues/3433)