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

Fix | Check for backup path existence #76

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LICENSE export-ignore
.php-cs-fixer.dist.php export-ignore
package.json export-ignore
webpack.mix.js export-ignore
phpstan.dist.neon export-ignore
8 changes: 8 additions & 0 deletions src/Services/BackupService.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,12 @@ public function setBackupPath(string $path): self

return $this;
}

/**
* Check if a backup has been created
*/
public function hasBackup(): bool
{
return isset($this->backupPath);
}
}
8 changes: 5 additions & 3 deletions src/Tasks/Pull/PullJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,13 @@ private function downloadBundleZip(string $file, string $checksum): string
*/
private function rollBack(Exception $exception): Exception
{
$this->artisan->note('⏳ Restoring backup...');
if ($this->backup->hasBackup()) {
$this->artisan->note('⏳ Restoring backup...');

$this->backup->restoreBackup($this->filesystem->getPublicPath());
$this->backup->restoreBackup($this->filesystem->getPublicPath());

$this->artisan->note('✅ Successfully restored backup.');
$this->artisan->note('✅ Successfully restored backup.');
}

$this->filesystem->deleteBaseLassoDirectory();

Expand Down
Binary file modified tests/Unit/Support/Zip/Destination/WithSubFolder.zip
Binary file not shown.