mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-24 18:54:44 +02:00

* add command to cleanup docker images * automatically cleanup images daily * fix request * fix empty check * run pint
51 lines
1.8 KiB
PHP
51 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Console;
|
|
|
|
use App\Jobs\NodeStatistics;
|
|
use App\Models\ActivityLog;
|
|
use Illuminate\Console\Scheduling\Schedule;
|
|
use Illuminate\Database\Console\PruneCommand;
|
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|
use App\Console\Commands\Schedule\ProcessRunnableCommand;
|
|
use App\Console\Commands\Maintenance\PruneOrphanedBackupsCommand;
|
|
use App\Console\Commands\Maintenance\CleanServiceBackupFilesCommand;
|
|
use App\Console\Commands\Maintenance\PruneImagesCommand;
|
|
|
|
class Kernel extends ConsoleKernel
|
|
{
|
|
/**
|
|
* Register the commands for the application.
|
|
*/
|
|
protected function commands(): void
|
|
{
|
|
$this->load(__DIR__ . '/Commands');
|
|
}
|
|
|
|
/**
|
|
* Define the application's command schedule.
|
|
*/
|
|
protected function schedule(Schedule $schedule): void
|
|
{
|
|
// https://laravel.com/docs/10.x/upgrade#redis-cache-tags
|
|
$schedule->command('cache:prune-stale-tags')->hourly();
|
|
|
|
// Execute scheduled commands for servers every minute, as if there was a normal cron running.
|
|
$schedule->command(ProcessRunnableCommand::class)->everyMinute()->withoutOverlapping();
|
|
|
|
$schedule->command(CleanServiceBackupFilesCommand::class)->daily();
|
|
$schedule->command(PruneImagesCommand::class)->daily();
|
|
|
|
$schedule->job(new NodeStatistics())->everyFiveSeconds()->withoutOverlapping();
|
|
|
|
if (config('backups.prune_age')) {
|
|
// Every 30 minutes, run the backup pruning command so that any abandoned backups can be deleted.
|
|
$schedule->command(PruneOrphanedBackupsCommand::class)->everyThirtyMinutes();
|
|
}
|
|
|
|
if (config('activity.prune_days')) {
|
|
$schedule->command(PruneCommand::class, ['--model' => [ActivityLog::class]])->daily();
|
|
}
|
|
}
|
|
}
|