Backup Rotation - Minor changes
This commit is contained in:
parent
1eaf486eaa
commit
7b8322e9c9
2 changed files with 9 additions and 9 deletions
|
@ -116,15 +116,15 @@ class InitiateBackupService
|
|||
}
|
||||
|
||||
// Check if the server has reached or exceeded it's backup limit
|
||||
if (! $server->backup_limit || $server->backups()->where('is_successful', true)->count() >= $server->backup_limit) {
|
||||
if($override) {
|
||||
// Remove latest backup
|
||||
$last_backup = $server->backups()->where('is_successful', true)->oldest()->first();
|
||||
$this->deleteBackupService->handle($last_backup);
|
||||
} else {
|
||||
// Do not allow the user to continue if this server is already at its limit.
|
||||
if (!$server->backup_limit || $server->backups()->where('is_successful', true)->count() >= $server->backup_limit) {
|
||||
// Do not allow the user to continue if this server is already at its limit and can't override.
|
||||
if (!$override || $server->backup_limit <= 0) {
|
||||
throw new TooManyBackupsException($server->backup_limit);
|
||||
}
|
||||
|
||||
// Remove latest backup
|
||||
$lastBackup = $server->backups()->where('is_successful', true)->orderByDesc('created_at')->first();
|
||||
$this->deleteBackupService->handle($lastBackup);
|
||||
}
|
||||
|
||||
return $this->connection->transaction(function () use ($server, $name) {
|
||||
|
|
|
@ -91,7 +91,7 @@ const TaskDetailsForm = ({ isEditingTask }: { isEditingTask: boolean }) => {
|
|||
<Label>Ignored Files</Label>
|
||||
<FormikFieldWrapper
|
||||
name={'payload'}
|
||||
description={'Optional. Include the files and folders to be excluded in this backup. By default, the contents of your .pteroignore file will be used.\nIf you have reached your backup limit, the oldest backup will be rotated.'}
|
||||
description={'Optional. Include the files and folders to be excluded in this backup. By default, the contents of your .pteroignore file will be used. If you have reached your backup limit, the oldest backup will be rotated.'}
|
||||
>
|
||||
<FormikField as={Textarea} name={'payload'} rows={6} />
|
||||
</FormikFieldWrapper>
|
||||
|
|
Loading…
Reference in a new issue