Ejemplo n.º 1
0
 public function handle()
 {
     consoleOutput()->comment('Starting cleanup...');
     try {
         $config = config('laravel-backup');
         $backupDestinations = BackupDestinationFactory::createFromArray($config['backup']);
         $strategy = app($config['cleanup']['strategy']);
         $cleanupJob = new CleanupJob($backupDestinations, $strategy);
         $cleanupJob->run();
         consoleOutput()->comment('Cleanup completed!');
     } catch (Exception $exception) {
         event(new CleanupHasFailed($exception));
         return -1;
     }
 }
Ejemplo n.º 2
0
 public static function createFromArray(array $config) : BackupJob
 {
     return (new BackupJob())->setFileSelection(static::createFileSelection($config['backup']['source']['files']))->setDbDumpers(static::createDbDumpers($config['backup']['source']['databases']))->setBackupDestinations(BackupDestinationFactory::createFromArray($config['backup']));
 }