File tree Expand file tree Collapse file tree 2 files changed +8
-20
lines changed
Expand file tree Collapse file tree 2 files changed +8
-20
lines changed Original file line number Diff line number Diff 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? ' ,
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments