mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-08-05 13:47:25 +02:00
record last cron expression (and stub owner_uid) used by scheduled task
This commit is contained in:
parent
fc059fc0fc
commit
5263a07f61
@ -6,7 +6,7 @@ class Config {
|
||||
const T_STRING = 2;
|
||||
const T_INT = 3;
|
||||
|
||||
const SCHEMA_VERSION = 150;
|
||||
const SCHEMA_VERSION = 151;
|
||||
|
||||
/** override default values, defined below in _DEFAULTS[], prefixing with _ENVVAR_PREFIX:
|
||||
*
|
||||
|
@ -33,6 +33,7 @@ class Pref_System extends Handler_Administrative {
|
||||
<table width='100%' class='event-log'>
|
||||
<tr>
|
||||
<th><?= __("Task name") ?></th>
|
||||
<th><?= __("Schedule") ?></th>
|
||||
<th><?= __("Last executed") ?></th>
|
||||
<th><?= __("Duration (seconds)") ?></th>
|
||||
<th><?= __("Return code") ?></th>
|
||||
@ -40,6 +41,7 @@ class Pref_System extends Handler_Administrative {
|
||||
<?php
|
||||
|
||||
$task_records = ORM::for_table('ttrss_scheduled_tasks')
|
||||
->order_by_asc(['last_cron_expression', 'task_name'])
|
||||
->find_many();
|
||||
|
||||
foreach ($task_records as $task) {
|
||||
@ -48,6 +50,7 @@ class Pref_System extends Handler_Administrative {
|
||||
?>
|
||||
<tr>
|
||||
<td class="<?= $row_style ?>"><?= $task->task_name ?></td>
|
||||
<td><?= $task->last_cron_expression ?></td>
|
||||
<td><?= TimeHelper::make_local_datetime($task->last_run) ?></td>
|
||||
<td><?= $task->last_duration ?></td>
|
||||
<td><?= $task->last_rc ?></td>
|
||||
|
@ -117,6 +117,7 @@ class Scheduler {
|
||||
$task_record->last_run = Db::NOW();
|
||||
$task_record->last_duration = $task_duration;
|
||||
$task_record->last_rc = $rc;
|
||||
$task_record->last_cron_expression = $task['cron']->getExpression();
|
||||
|
||||
$task_record->save();
|
||||
} else {
|
||||
@ -127,6 +128,7 @@ class Scheduler {
|
||||
'last_duration' => $task_duration,
|
||||
'last_rc' => $rc,
|
||||
'last_run' => Db::NOW(),
|
||||
'last_cron_expression' => $task['cron']->getExpression()
|
||||
]);
|
||||
|
||||
$task_record->save();
|
||||
|
6
sql/pgsql/migrations/151.sql
Normal file
6
sql/pgsql/migrations/151.sql
Normal file
@ -0,0 +1,6 @@
|
||||
alter table ttrss_scheduled_tasks add column owner_uid integer default null references ttrss_users(id) ON DELETE CASCADE;
|
||||
alter table ttrss_scheduled_tasks add column last_cron_expression varchar(250);
|
||||
|
||||
update ttrss_scheduled_tasks set last_cron_expression = '';
|
||||
|
||||
alter table ttrss_scheduled_tasks alter column last_cron_expression set not null;
|
@ -400,6 +400,8 @@ create table ttrss_scheduled_tasks(
|
||||
task_name varchar(250) unique not null,
|
||||
last_duration integer not null,
|
||||
last_rc integer not null,
|
||||
last_run timestamp not null default NOW());
|
||||
last_run timestamp not null default NOW(),
|
||||
last_cron_expression varchar(250) not null,
|
||||
owner_uid integer default null references ttrss_users(id) ON DELETE CASCADE);
|
||||
|
||||
commit;
|
||||
|
Loading…
Reference in New Issue
Block a user