Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of --dump parameter? #34

Open
lupinitylabs opened this issue May 30, 2022 · 0 comments
Open

Get rid of --dump parameter? #34

lupinitylabs opened this issue May 30, 2022 · 0 comments

Comments

@lupinitylabs
Copy link
Member

lupinitylabs commented May 30, 2022

I don't see the need for both the --file and --dump parameters - they are essentially doing the same.

Since the --file parameter expects an absolute path, the --dump (or --file) parameter could be removed and all files without paths could safely be assumed to be in the database folder.

Another benefit besides shortening the parameter list would be that it removes some of the logic and allows for the use of a match statement at

if ($optionRemote) {
.

Furthermore, I find the double use of $localFilePath at

$localFilePath = $this->protector->createTempFilePath($importFilePath);
confusing, which could be either a temporary file copy of an imported dump or an existing dump file in the database dump folder, which requires an additional check at
if (!$optionFile) {
to see if it can be deleted.

I feel like all the logic in the handle() method could be refactored and maybe included in importDump(), or having additional methods like importDumpFromTempFile(), importLatestDump() or importDumpFromRemote(), to make the code more readable and move the logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant