mirror of
https://github.com/itflow-org/itflow
synced 2026-12-05 10:39:00 +00:00
CrowdSec no longer blocks new tickets and recurring tickets: the work-booking fields CrowdSec's copy of the OWASP Core Rule Set took for the Unix command sched are renamed book_at, book_minutes, book_onsite, book_time and book_agent in New Ticket, Dispatch's link to it, the Schedule window, the helper window and recurring tickets, the cron job window's field is job_schedule, the tickets list's Scheduled tab is show=booked, Maintenance > Cron sorts by when, and Stripe Checkout returns with checkout in place of session_id, each still accepting the old name; CONTRIBUTING.md rule and 26.12.6 changelog
This commit is contained in:
@@ -16,8 +16,9 @@
|
||||
* there is nothing to change about it until cron has run once.
|
||||
*/
|
||||
|
||||
// The list: by schedule until a heading is clicked - the every-minute jobs, then the day's in the order they run
|
||||
$sort = "schedule";
|
||||
// The list: by schedule until a heading is clicked - the every-minute jobs, then the day's in the order they run.
|
||||
// Its key is when, not schedule: a web application firewall takes a value starting sched for the Unix command.
|
||||
$sort = "when";
|
||||
$order = "ASC";
|
||||
|
||||
require_once "includes/inc_all_admin.php";
|
||||
@@ -233,23 +234,26 @@ $command_block = function () use ($cron_command) {
|
||||
};
|
||||
$owner_note = $file_owner !== '' ? ' (<code>' . escapeHtml($file_owner) . '</code> here)' : '';
|
||||
|
||||
// The list - only these sort; anything else asked for falls back to the schedule
|
||||
// The list - only these sort; anything else asked for falls back to the schedule (schedule is when's name from before)
|
||||
if ($sort === 'schedule') {
|
||||
$sort = 'when';
|
||||
}
|
||||
$sort_keys = [
|
||||
'job' => function ($job) { return strtolower($job['label']); },
|
||||
'schedule' => function ($job) { return $job['schedule'] === 'Daily' ? 100000 + intval(substr($job['daily_at'], 0, 2)) * 60 + intval(substr($job['daily_at'], 3, 2)) : $job['interval_minutes']; },
|
||||
'when' => function ($job) { return $job['schedule'] === 'Daily' ? 100000 + intval(substr($job['daily_at'], 0, 2)) * 60 + intval(substr($job['daily_at'], 3, 2)) : $job['interval_minutes']; },
|
||||
'last_run' => function ($job) { return $job['last_run_at'] ? strtotime($job['last_run_at']) : 0; },
|
||||
// What needs a look first
|
||||
'status' => function ($job) { return array_search($job['state'], ['failed', 'lost', 'queued', 'running', 'paused', 'skipped', 'never', 'completed', 'unused'], true); },
|
||||
];
|
||||
if (!isset($sort_keys[$sort])) {
|
||||
$sort = 'schedule';
|
||||
$sort = 'when';
|
||||
}
|
||||
uasort($jobs, function ($a, $b) use ($sort_keys, $sort, $order) {
|
||||
$compared = $sort_keys[$sort]($a) <=> $sort_keys[$sort]($b);
|
||||
return ($order === 'DESC' ? -$compared : $compared) ?: $a['position'] <=> $b['position'];
|
||||
});
|
||||
// A heading sorts its own way round first - names A to Z, the latest run and what needs a look at the top - then the other
|
||||
$sort_first = ['job' => 'ASC', 'schedule' => 'ASC', 'last_run' => 'DESC', 'status' => 'ASC'];
|
||||
$sort_first = ['job' => 'ASC', 'when' => 'ASC', 'last_run' => 'DESC', 'status' => 'ASC'];
|
||||
$sort_link = function ($column, $label) use ($sort_first) {
|
||||
return sortLink($column, $label, $sort_first[$column] ?? null);
|
||||
};
|
||||
@@ -387,7 +391,7 @@ $status_looks = [
|
||||
<thead class="table-light text-nowrap">
|
||||
<tr>
|
||||
<th class="ps-3" colspan="2"><?= $sort_link('job', 'Job') ?></th>
|
||||
<th class="d-none d-md-table-cell"><?= $sort_link('schedule', 'Schedule') ?></th>
|
||||
<th class="d-none d-md-table-cell"><?= $sort_link('when', 'Schedule') ?></th>
|
||||
<th class="d-none d-md-table-cell"><?= $sort_link('last_run', 'Last run') ?></th>
|
||||
<th><?= $sort_link('status', 'Status') ?></th>
|
||||
<th></th>
|
||||
|
||||
Reference in New Issue
Block a user