diff --git a/composer.json b/composer.json index cb2cef39..4bb3af3e 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "require": { "php" : ">=5.4.0", "illuminate/support": "5.*", - "illuminate/console": "5.*" + "illuminate/console": "5.*", + "symfony/finder": "~2.6" }, "require-dev": { diff --git a/src/BackupHandlers/Files/FilesBackupHandler.php b/src/BackupHandlers/Files/FilesBackupHandler.php index e4da4968..929b8b06 100644 --- a/src/BackupHandlers/Files/FilesBackupHandler.php +++ b/src/BackupHandlers/Files/FilesBackupHandler.php @@ -5,6 +5,7 @@ use File; use Spatie\Backup\BackupHandlers\BackupHandlerInterface; use SplFileInfo; +use Symfony\Component\Finder\Finder; class FilesBackupHandler implements BackupHandlerInterface { @@ -65,7 +66,7 @@ public function getAllPathFromFileArray($fileArray) } if (File::isDirectory($file)) { - $files = array_merge($files, File::allFiles($file)); + $files = array_merge($files, $this->getAllFilesFromDirectory($file)); } } @@ -73,4 +74,15 @@ public function getAllPathFromFileArray($fileArray) return $file->getPathName(); }, $files)); } + + protected function getAllFilesFromDirectory($directory) + { + $finder = (new Finder()) + ->ignoreDotFiles(false) + ->ignoreVCS(false) + ->files() + ->in($directory); + + return iterator_to_array($finder); + } }