Skip to content

Commit 0e936bf

Browse files
fix(restore): remove option to not remove uploaded backup after restore
BREAKING CHANGE: `destroyAfterRestore` parameter no longer has an effect and it will always be deleted
1 parent 3a25807 commit 0e936bf

File tree

5 files changed

+2
-14
lines changed

5 files changed

+2
-14
lines changed

client/src/components/Actions.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ export default {
9090
this.$axios
9191
.post(cp_url("api/backups/restore-from-path"), {
9292
path: file.path,
93-
destroyAfterRestore: true,
9493
})
9594
.then(({ data }) => {
9695
this.$toast.info(__(data.message));

src/Http/Controllers/Api/RestoreFromPathController.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@
1515
{
1616
public function __invoke(RestoreFromPathRequest $request, StateManager $stateManager): JsonResponse
1717
{
18-
$stateManager->dispatch(
19-
new RestoreFromPathJob(
20-
path: $request->validated('path'),
21-
deleteAfter: $request->input('destroyAfterRestore', false),
22-
),
23-
);
18+
$stateManager->dispatch(new RestoreFromPathJob(path: $request->validated('path')));
2419

2520
return response()->json(['message' => __('statamic-backup::backup.restore.started')]);
2621
}

src/Http/Requests/RestoreFromPathRequest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public function rules(): array
1212
{
1313
return [
1414
'path' => 'required|string',
15-
'destroyAfterRestore' => 'nullable|boolean',
1615
];
1716
}
1817
}

src/Jobs/RestoreFromPathJob.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ final class RestoreFromPathJob implements ShouldQueue
2121
*/
2222
public function __construct(
2323
private string $path,
24-
private bool $deleteAfter,
2524
) {
2625
}
2726

@@ -34,9 +33,7 @@ public function handle(Restorer $restorer, Repository $cache): void
3433

3534
$cache->forget(StateManager::JOB_QUEUED_KEY);
3635

37-
if ($this->deleteAfter) {
38-
File::delete($this->path);
39-
}
36+
File::delete($this->path);
4037
}
4138

4239
public function failed(): void

tests/Feature/RestoreFromPathTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050

5151
$response = postJson(cp_route('api.itiden.backup.restore-from-path'), [
5252
'path' => $path,
53-
'destroyAfterRestore' => true,
5453
]);
5554

5655
expect($response->status())->toBe(Response::HTTP_OK);
@@ -77,7 +76,6 @@
7776

7877
$response = postJson(cp_route('api.itiden.backup.restore-from-path'), [
7978
'path' => $emptyArchive,
80-
'destroyAfterRestore' => true,
8179
]);
8280

8381
Event::assertDispatched(RestoreFailed::class);

0 commit comments

Comments
 (0)