Skip to content

Commit c00b8d4

Browse files
authored
Merge pull request #76 from Sammyjo20/fix/backup-service-check
Fix | Check for backup path existence
2 parents 3e57cd3 + 12df6d3 commit c00b8d4

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ LICENSE export-ignore
88
.php-cs-fixer.dist.php export-ignore
99
package.json export-ignore
1010
webpack.mix.js export-ignore
11+
phpstan.dist.neon export-ignore

src/Services/BackupService.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,12 @@ public function setBackupPath(string $path): self
7171

7272
return $this;
7373
}
74+
75+
/**
76+
* Check if a backup has been created
77+
*/
78+
public function hasBackup(): bool
79+
{
80+
return isset($this->backupPath);
81+
}
7482
}

src/Tasks/Pull/PullJob.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,13 @@ private function downloadBundleZip(string $file, string $checksum): string
250250
*/
251251
private function rollBack(Exception $exception): Exception
252252
{
253-
$this->artisan->note('⏳ Restoring backup...');
253+
if ($this->backup->hasBackup()) {
254+
$this->artisan->note('⏳ Restoring backup...');
254255

255-
$this->backup->restoreBackup($this->filesystem->getPublicPath());
256+
$this->backup->restoreBackup($this->filesystem->getPublicPath());
256257

257-
$this->artisan->note('✅ Successfully restored backup.');
258+
$this->artisan->note('✅ Successfully restored backup.');
259+
}
258260

259261
$this->filesystem->deleteBaseLassoDirectory();
260262

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)