stefanzweifel / laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.
https://stefanzweifel.dev/posts/2023/06/15/introducing-laravel-backup-restore
MIT License
165 stars 15 forks source link

Use the same method to check dump and get a list of dumps #60

Closed alies-dev closed 10 months ago

alies-dev commented 10 months ago

There are few ways to solve the issue. This PR uses PendingRestore::getAvailableDbDumps to check existence of dumps; another way - add the same file extension filter to PendingRestore::hasNoDbDumpsDirectory. I prefer the current approach to make codebase smaller and do not repeat the logic. But I'm ok to fix PendingRestore::hasNoDbDumpsDirectory if you think it's better.

BTW, it was the only usage of PendingRestore::hasNoDbDumpsDirectory. I haven't removed this method because it was public and not marked as @internal (which means it will be BC break).


PS: I discovered this issue debugging my CI check (probably caused by the DB connection misconfiguration), the message was really confusing:

image

"dumps" is plural because it should be plural for zero :)

PPS: How about listing all extracted files in the NoDatabaseDumpsFound message? This will improve debugging experience a lot. I can create a PR.