Written from model events, spatie's role events and panel sign-ins, only for what a person did, with secrets masked; pruned after a year. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55 lines
1.7 KiB
PHP
55 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\AuditLog;
|
|
use Illuminate\Support\Facades\Schedule;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Scheduled tasks
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Keeping repository stats fresh is what stops the public site from looking
|
|
| abandoned, which is the main risk for a site like this. `withoutOverlapping`
|
|
| guards against a slow run colliding with the next tick.
|
|
|
|
|
*/
|
|
|
|
/*
|
|
* Publication windows are enforced by the `published` scopes, so content
|
|
* appears and disappears on time whether or not this runs. What it does is
|
|
* keep the stored state honest — a call the site stopped offering weeks ago
|
|
* should not still say "Open" in the panel.
|
|
*/
|
|
Schedule::command('content:schedule')
|
|
->everyFiveMinutes()
|
|
->withoutOverlapping()
|
|
->runInBackground();
|
|
|
|
/*
|
|
* Safety net for image processing. Uploads queue their own work, but a worker
|
|
* that is down would otherwise leave images without dimensions indefinitely —
|
|
* and the symptom, a page that reflows as it loads, is easy to miss.
|
|
*/
|
|
Schedule::command('media:process')
|
|
->everyTenMinutes()
|
|
->withoutOverlapping()
|
|
->runInBackground();
|
|
|
|
Schedule::command('repos:sync')
|
|
->cron(match ($cron = (string) config('git.sync_cron', 'hourly')) {
|
|
'hourly' => '0 * * * *',
|
|
'daily' => '0 4 * * *',
|
|
default => $cron,
|
|
})
|
|
->withoutOverlapping()
|
|
->runInBackground();
|
|
|
|
// Old audit entries: they name people and the addresses they worked from, so
|
|
// they are kept for `audit.retention_days` and no longer.
|
|
Schedule::command('model:prune', ['--model' => [AuditLog::class]])
|
|
->daily()
|
|
->withoutOverlapping()
|
|
->runInBackground();
|