Skip to content

Commit 5e08e19

Browse files
Remove unused method to support restoring from any path
1 parent d712c2f commit 5e08e19

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

src/Console/Commands/RestoreCommand.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ final class RestoreCommand extends Command
2222

2323
public function handle(BackupRepository $repo): void
2424
{
25-
/* @var BackupDto $backup */
25+
/** @var BackupDto $backup */
2626
$backup = match (true) {
27-
(bool) $this->option('path') => BackupDto::fromAbsolutePath($this->option('path')),
27+
(bool) $this->option('path') => new BackupDto(
28+
'not-that-important',
29+
basename($this->option('path')),
30+
now()->toImmutable(),
31+
(string) filesize($this->option('path')),
32+
$this->option('path'),
33+
),
2834
default
2935
=> BackupDto::fromFile(select(
3036
label: 'Which backup do you want to restore to?',

src/DataTransferObjects/BackupDto.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,4 @@ public static function fromFile(string $path): static
4444
path: $path,
4545
);
4646
}
47-
48-
/**
49-
* Create a new BackupDto from a absolute path
50-
*/
51-
public static function fromAbsolutePath(string $path): static
52-
{
53-
$values = app(BackupNameResolver::class)->parseFilename($path);
54-
55-
$bytes = File::size($path);
56-
57-
return new static(
58-
id: $values->id,
59-
name: $values->name,
60-
created_at: $values->createdAt,
61-
size: StatamicStr::fileSizeForHumans($bytes, 2),
62-
path: $path,
63-
);
64-
}
6547
}

0 commit comments

Comments
 (0)