2015-12-06 13:58:49 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Console;
|
|
|
|
|
2022-05-29 19:45:00 -04:00
|
|
|
use Pterodactyl\Models\ActivityLog;
|
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;
|
2022-05-29 19:45:00 -04:00
|
|
|
use Pterodactyl\Console\Commands\Schedule\ProcessRunnableCommand;
|
|
|
|
use Pterodactyl\Console\Commands\Maintenance\PruneOrphanedBackupsCommand;
|
|
|
|
use Pterodactyl\Console\Commands\Maintenance\CleanServiceBackupFilesCommand;
|
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
|
|
|
*/
|
2017-12-17 13:07:38 -06:00
|
|
|
protected function commands()
|
|
|
|
{
|
|
|
|
$this->load(__DIR__ . '/Commands');
|
|
|
|
}
|
2015-12-06 13:58:49 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the application's command schedule.
|
|
|
|
*/
|
|
|
|
protected function schedule(Schedule $schedule)
|
|
|
|
{
|
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();
|
|
|
|
$schedule->command(CleanServiceBackupFilesCommand::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();
|
|
|
|
}
|
2015-12-06 13:58:49 -05:00
|
|
|
}
|
|
|
|
}
|