diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 1f83ddf93..a052ae39e 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -25,11 +25,13 @@ class Kernel extends ConsoleKernel // Execute scheduled commands for servers every minute, as if there was a normal cron running. $schedule->command('p:schedule:process')->everyMinute()->withoutOverlapping(); - // Every 30 minutes, run the backup pruning command so that any abandoned backups can be removed - // from the UI view for the server. - $schedule->command('p:maintenance:prune-backups', [ - '--since-minutes' => '30', - ])->everyThirtyMinutes(); + // Every 30 minutes, run the backup pruning command so that any abandoned backups can be deleted. + $pruneAge = config('backups.prune_age', 60); + if ($pruneAge > 0) { + $schedule->command('p:maintenance:prune-backups', [ + '--since-minutes' => $pruneAge, + ])->everyThirtyMinutes(); + } // Every day cleanup any internal backups of service files. $schedule->command('p:maintenance:clean-service-backups')->daily(); diff --git a/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php b/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php index 497d12904..6d50ad64d 100644 --- a/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php +++ b/app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php @@ -52,7 +52,7 @@ class BackupRemoteUploadController extends Controller public function __invoke(Request $request, string $backup) { // Get the size query parameter. - $size = (int)$request->query('size'); + $size = (int) $request->query('size'); if (empty($size)) { throw new BadRequestHttpException('A non-empty "size" query parameter must be provided.'); } diff --git a/config/backups.php b/config/backups.php index 32ee1aa8a..b2c16f1a1 100644 --- a/config/backups.php +++ b/config/backups.php @@ -12,6 +12,10 @@ return [ // uses to upload backups to S3 storage. Value is in minutes, so this would default to an hour. 'presigned_url_lifespan' => env('BACKUP_PRESIGNED_URL_LIFESPAN', 60), + // The time in which to wait before automatically marking a backup as failed. + // To disable this feature, set the value to `0`. + 'prune_age' => env('BACKUP_PRUNE_AGE', 60), + 'disks' => [ // There is no configuration for the local disk for Wings. That configuration // is determined by the Daemon configuration, and not the Panel.