Skip to content

Commit 2f17e75

Browse files
authored
Merge pull request pterodactyl#2879 from pterodactyl/fix/backups-failing-early
Allow changing the prune age for backups
2 parents e678537 + 17ca365 commit 2f17e75

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

app/Console/Kernel.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ protected function schedule(Schedule $schedule)
2525
// Execute scheduled commands for servers every minute, as if there was a normal cron running.
2626
$schedule->command('p:schedule:process')->everyMinute()->withoutOverlapping();
2727

28-
// Every 30 minutes, run the backup pruning command so that any abandoned backups can be removed
29-
// from the UI view for the server.
30-
$schedule->command('p:maintenance:prune-backups', [
31-
'--since-minutes' => '30',
32-
])->everyThirtyMinutes();
28+
// Every 30 minutes, run the backup pruning command so that any abandoned backups can be deleted.
29+
$pruneAge = config('backups.prune_age', 360); // Defaults to 6 hours (time is in minuteS)
30+
if ($pruneAge > 0) {
31+
$schedule->command('p:maintenance:prune-backups', [
32+
'--since-minutes' => $pruneAge,
33+
])->everyThirtyMinutes();
34+
}
3335

3436
// Every day cleanup any internal backups of service files.
3537
$schedule->command('p:maintenance:clean-service-backups')->daily();

app/Http/Controllers/Api/Remote/Backups/BackupRemoteUploadController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function __construct(BackupRepository $repository, BackupManager $backupM
5252
public function __invoke(Request $request, string $backup)
5353
{
5454
// Get the size query parameter.
55-
$size = (int)$request->query('size');
55+
$size = (int) $request->query('size');
5656
if (empty($size)) {
5757
throw new BadRequestHttpException('A non-empty "size" query parameter must be provided.');
5858
}

config/backups.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
// uses to upload backups to S3 storage. Value is in minutes, so this would default to an hour.
1313
'presigned_url_lifespan' => env('BACKUP_PRESIGNED_URL_LIFESPAN', 60),
1414

15+
// The time to wait before automatically failing a backup, time is in minutes and defaults
16+
// to 6 hours. To disable this feature, set the value to `0`.
17+
'prune_age' => env('BACKUP_PRUNE_AGE', 360),
18+
1519
'disks' => [
1620
// There is no configuration for the local disk for Wings. That configuration
1721
// is determined by the Daemon configuration, and not the Panel.

0 commit comments

Comments
 (0)