From 5139c47f2547c927d2aa1ad428e73992d967ea6e Mon Sep 17 00:00:00 2001 From: Ioannis Botis Date: Thu, 26 Mar 2020 16:22:05 +0200 Subject: [PATCH] Issue 68, Not found .json (settings) at first run for Tar backup. --- src/Backup/Destination/Base.php | 6 +++++- src/Backup/Destination/Local.php | 8 ++++++-- src/Backup/Tools/Tar.php | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Backup/Destination/Base.php b/src/Backup/Destination/Base.php index 3e45fdf..3ca5d2c 100644 --- a/src/Backup/Destination/Base.php +++ b/src/Backup/Destination/Base.php @@ -40,7 +40,11 @@ public function canAccess(); */ public function listContents($dir = '', $recursive = false); + /** + * @param string $file The path to the file. + * @return string|false The file contents or false on failure. + */ public function read($file); public function write($filename, $contents); -} \ No newline at end of file +} diff --git a/src/Backup/Destination/Local.php b/src/Backup/Destination/Local.php index fa4dd31..56ffa65 100644 --- a/src/Backup/Destination/Local.php +++ b/src/Backup/Destination/Local.php @@ -50,7 +50,11 @@ public function canAccess() public function read($file) { - return $this->filesystem->read($file); + try { + return $this->filesystem->read($file); + } catch (\League\Flysystem\FileNotFoundException $e) { + return false; + } } public function listContents($dir = '', $recursive = false) @@ -65,4 +69,4 @@ public function write($filename, $contents) } return $this->filesystem->put($filename, $contents); } -} \ No newline at end of file +} diff --git a/src/Backup/Tools/Tar.php b/src/Backup/Tools/Tar.php index bbfef17..0694e29 100644 --- a/src/Backup/Tools/Tar.php +++ b/src/Backup/Tools/Tar.php @@ -341,4 +341,4 @@ public function getOutput() { return $this->_output; } -} \ No newline at end of file +}