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.'], + ]; + } }