2015-12-06 13:58:49 -05:00
|
|
|
<?php
|
|
|
|
|
|
2024-03-12 22:39:16 -04:00
|
|
|
namespace App\Console;
|
2015-12-06 13:58:49 -05:00
|
|
|
|
2024-10-15 22:54:06 +02:00
|
|
|
use App\Console\Commands\Egg\CheckEggUpdatesCommand;
|
2025-06-26 01:50:09 +02:00
|
|
|
use App\Console\Commands\Egg\UpdateEggIndexCommand;
|
2024-10-15 22:54:06 +02:00
|
|
|
use App\Console\Commands\Maintenance\CleanServiceBackupFilesCommand;
|
|
|
|
|
use App\Console\Commands\Maintenance\PruneImagesCommand;
|
|
|
|
|
use App\Console\Commands\Maintenance\PruneOrphanedBackupsCommand;
|
|
|
|
|
use App\Console\Commands\Schedule\ProcessRunnableCommand;
|
2024-03-12 22:39:16 -04:00
|
|
|
use App\Models\ActivityLog;
|
2024-10-28 23:44:32 +01:00
|
|
|
use App\Models\Webhook;
|
2015-12-06 13:58:49 -05:00
|
|
|
use Illuminate\Console\Scheduling\Schedule;
|
2022-05-29 19:45:00 -04:00
|
|
|
use Illuminate\Database\Console\PruneCommand;
|
2015-12-06 13:58:49 -05:00
|
|
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
2024-12-24 19:09:16 +01:00
|
|
|
use Spatie\Health\Commands\RunHealthChecksCommand;
|
|
|
|
|
use Spatie\Health\Commands\ScheduleCheckHeartbeatCommand;
|
2015-12-06 13:58:49 -05:00
|
|
|
|
|
|
|
|
class Kernel extends ConsoleKernel
|
|
|
|
|
{
|
|
|
|
|
/**
|
2017-12-17 13:07:38 -06:00
|
|
|
* Register the commands for the application.
|
2015-12-06 13:58:49 -05:00
|
|
|
*/
|
2023-02-23 12:30:16 -07:00
|
|
|
protected function commands(): void
|
2017-12-17 13:07:38 -06:00
|
|
|
{
|
|
|
|
|
$this->load(__DIR__ . '/Commands');
|
|
|
|
|
}
|
2015-12-06 13:58:49 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Define the application's command schedule.
|
|
|
|
|
*/
|
2023-02-23 12:30:16 -07:00
|
|
|
protected function schedule(Schedule $schedule): void
|
2015-12-06 13:58:49 -05:00
|
|
|
{
|
2025-05-05 16:43:27 -04:00
|
|
|
if (config('cache.default') === 'redis') {
|
|
|
|
|
// https://laravel.com/docs/10.x/upgrade#redis-cache-tags
|
|
|
|
|
// This only needs to run when using redis. anything else throws an error.
|
|
|
|
|
$schedule->command('cache:prune-stale-tags')->hourly();
|
|
|
|
|
}
|
2023-02-23 12:30:16 -07:00
|
|
|
|
2020-08-20 20:48:08 -07:00
|
|
|
// Execute scheduled commands for servers every minute, as if there was a normal cron running.
|
2022-05-29 19:45:00 -04:00
|
|
|
$schedule->command(ProcessRunnableCommand::class)->everyMinute()->withoutOverlapping();
|
2024-07-20 17:23:03 +02:00
|
|
|
|
2022-05-29 19:45:00 -04:00
|
|
|
$schedule->command(CleanServiceBackupFilesCommand::class)->daily();
|
2024-07-20 17:23:03 +02:00
|
|
|
$schedule->command(PruneImagesCommand::class)->daily();
|
2025-06-26 01:50:09 +02:00
|
|
|
|
|
|
|
|
$schedule->command(CheckEggUpdatesCommand::class)->daily();
|
|
|
|
|
$schedule->command(UpdateEggIndexCommand::class)->daily();
|
2020-08-20 20:48:08 -07:00
|
|
|
|
2021-01-23 14:12:15 -08:00
|
|
|
if (config('backups.prune_age')) {
|
|
|
|
|
// Every 30 minutes, run the backup pruning command so that any abandoned backups can be deleted.
|
2022-05-29 19:45:00 -04:00
|
|
|
$schedule->command(PruneOrphanedBackupsCommand::class)->everyThirtyMinutes();
|
2020-12-16 14:15:07 -07:00
|
|
|
}
|
2020-08-20 20:48:08 -07:00
|
|
|
|
2022-05-29 19:45:00 -04:00
|
|
|
if (config('activity.prune_days')) {
|
|
|
|
|
$schedule->command(PruneCommand::class, ['--model' => [ActivityLog::class]])->daily();
|
|
|
|
|
}
|
2024-10-28 23:44:32 +01:00
|
|
|
|
|
|
|
|
if (config('panel.webhook.prune_days')) {
|
|
|
|
|
$schedule->command(PruneCommand::class, ['--model' => [Webhook::class]])->daily();
|
|
|
|
|
}
|
2024-12-24 19:09:16 +01:00
|
|
|
|
|
|
|
|
$schedule->command(ScheduleCheckHeartbeatCommand::class)->everyMinute();
|
|
|
|
|
$schedule->command(RunHealthChecksCommand::class)->everyFiveMinutes();
|
2015-12-06 13:58:49 -05:00
|
|
|
}
|
|
|
|
|
}
|