From 8b36be05cf51a6eaf2963ca367f4e24f0ed1b7cd Mon Sep 17 00:00:00 2001 From: MatthiasDeWinter Date: Wed, 18 Mar 2015 14:36:59 +0000 Subject: [PATCH] add only-db option --- src/Commands/BackupCommand.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Commands/BackupCommand.php b/src/Commands/BackupCommand.php index 86259be0..beb12e92 100644 --- a/src/Commands/BackupCommand.php +++ b/src/Commands/BackupCommand.php @@ -4,6 +4,7 @@ use Spatie\Backup\BackupHandlers\Database\DatabaseBackupHandler; use Spatie\Backup\BackupHandlers\Files\FilesBackupHandler; use Illuminate\Support\Facades\Storage; +use Symfony\Component\Console\Input\InputOption; use ZipArchive; class BackupCommand extends Command @@ -73,6 +74,11 @@ protected function getAllFilesToBeBackedUp() $this->comment('Database dumped'); } + if($this->option('only-db')) + { + return $files; + } + $this->comment('Determining which files should be backed up...'); $fileBackupHandler = app()->make(FilesBackupHandler::class) ->setIncludedFiles(config('laravel-backup.source.files.include')) @@ -175,4 +181,16 @@ protected function getBackupDestinationFileName() { return config('laravel-backup.destination.path').'/'.date('YmdHis').'.zip'; } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['only-db', null, InputOption::VALUE_NONE, 'Only backup the database.'], + ]; + } }