Skip to content

Commit

Permalink
Better unpacked dump detection (#62)
Browse files Browse the repository at this point in the history
* Better unpacked dump detection

* Mark hasNoDbDumpsDirectory as deprecated

---------

Co-authored-by: Stefan Zweifel <[email protected]>
  • Loading branch information
alies-dev and stefanzweifel authored Jan 31, 2024
1 parent b033e22 commit 67edf10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Actions/ImportDumpAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ class ImportDumpAction
*/
public function execute(PendingRestore $pendingRestore): void
{
if ($pendingRestore->hasNoDbDumpsDirectory()) {
$dbDumps = $pendingRestore->getAvailableDbDumps();

if ($dbDumps->isEmpty()) {
throw NoDatabaseDumpsFound::notFoundInBackup($pendingRestore);
}

$importer = DbImporterFactory::createFromConnection($pendingRestore->connection);

$dbDumps = $pendingRestore->getAvailableDbDumps();

info('Importing database '.str('dump')->plural($dbDumps)->__toString().'');

$dbDumps->each(function ($dbDump) use ($pendingRestore, $importer) {
Expand Down
1 change: 1 addition & 0 deletions src/PendingRestore.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function getAbsolutePathToLocalDecompressedBackup(): string
return storage_path('app'.DIRECTORY_SEPARATOR.'backup-restore-temp'.DIRECTORY_SEPARATOR.$filename);
}

/** @deprecated */
public function hasNoDbDumpsDirectory(): bool
{
return ! Storage::disk($this->restoreDisk)
Expand Down

0 comments on commit 67edf10

Please sign in to comment.