* Add alternative to using the artisan schedule runner * StyleCI fixes * Add additional cron time periods * Style fixes * Typo * Update the web cron to use the new system * Write out JSON for which tasks were run * Rename cron.php to just cron
31 lines
666 B
PHP
31 lines
666 B
PHP
<?php
|
|
|
|
namespace App\Cron\Hourly;
|
|
|
|
use App\Contracts\Listener;
|
|
use App\Events\CronHourly;
|
|
use App\Services\SimBriefService;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
/**
|
|
* Clear any expired SimBrief flight briefs that aren't attached to a PIREP
|
|
*/
|
|
class ClearExpiredSimbrief extends Listener
|
|
{
|
|
private $simbriefSvc;
|
|
|
|
public function __construct(SimBriefService $simbriefSvc)
|
|
{
|
|
$this->simbriefSvc = $simbriefSvc;
|
|
}
|
|
|
|
/**
|
|
* @param CronHourly $event
|
|
*/
|
|
public function handle(CronHourly $event): void
|
|
{
|
|
Log::info('Hourly: Removing expired Simbrief entries');
|
|
$this->simbriefSvc->removeExpiredEntries();
|
|
}
|
|
}
|