generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for checking backups on filesystem disks
- Loading branch information
Showing
3 changed files
with
127 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
namespace Spatie\Health\Support; | ||
|
||
use Illuminate\Contracts\Filesystem\Filesystem; | ||
use Symfony\Component\HttpFoundation\File\File as SymfonyFile; | ||
|
||
class BackupFile { | ||
protected ?SymfonyFile $file = null; | ||
|
||
public function __construct( | ||
protected string $path, | ||
protected ?Filesystem $disk = null, | ||
) { | ||
if (!$disk) { | ||
$this->file = new SymfonyFile($path); | ||
} | ||
} | ||
|
||
public function path(): string | ||
{ | ||
return $this->path; | ||
} | ||
|
||
public function size(): int | ||
{ | ||
return $this->file ? $this->file->getSize() : $this->disk->size($this->path); | ||
} | ||
|
||
public function lastModified(): int | ||
{ | ||
return $this->file ? $this->file->getMTime() : $this->disk->lastModified($this->path); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters