backups: allow updating a failed backup (#3470)

This commit is contained in:
Matthew Penner 2021-07-18 09:46:20 -06:00 committed by GitHub
parent 4a4af7deb7
commit 1a79b4827c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,7 +42,7 @@ class BackupStatusController extends Controller
/** @var \Pterodactyl\Models\Backup $model */ /** @var \Pterodactyl\Models\Backup $model */
$model = Backup::query()->where('uuid', $backup)->firstOrFail(); $model = Backup::query()->where('uuid', $backup)->firstOrFail();
if (!is_null($model->completed_at)) { if ($model->is_successful) {
throw new BadRequestHttpException('Cannot update the status of a backup that is already marked as completed.'); throw new BadRequestHttpException('Cannot update the status of a backup that is already marked as completed.');
} }
@ -54,7 +54,7 @@ class BackupStatusController extends Controller
$audit->is_system = true; $audit->is_system = true;
$audit->metadata = ['backup_uuid' => $model->uuid]; $audit->metadata = ['backup_uuid' => $model->uuid];
$successful = $request->input('successful') ? true : false; $successful = $request->boolean('successful');
$model->fill([ $model->fill([
'is_successful' => $successful, 'is_successful' => $successful,
// Change the lock state to unlocked if this was a failed backup so that it can be // Change the lock state to unlocked if this was a failed backup so that it can be