Code Duplication    Length = 15-15 lines in 2 locations

code/backends/CapistranoDeploymentBackend.php 2 locations

@@ 440-454 (lines=15) @@
437
		};
438
439
		// Restore database into target environment
440
		if(in_array($dataTransfer->Mode, array('all', 'db'))) {
441
			$log->write(sprintf('Restore of database to "%s" started', $name));
442
			$args = array('data_path' => $workingDir . DIRECTORY_SEPARATOR . 'database.sql');
443
			$command = $this->getCommand('data:pushdb', 'db', $environment, $args, $log);
444
			$command->run(function($type, $buffer) use($log) {
445
				$log->write($buffer);
446
			});
447
			if(!$command->isSuccessful()) {
448
				$cleanupFn();
449
				$log->write(sprintf('Restore of database to "%s" failed: %s', $name, $command->getErrorOutput()));
450
				$this->extend('dataTransferFailure', $environment, $log);
451
				throw new RuntimeException($command->getErrorOutput());
452
			}
453
			$log->write(sprintf('Restore of database to "%s" done', $name));
454
		}
455
456
		// Restore assets into target environment
457
		if(in_array($dataTransfer->Mode, array('all', 'assets'))) {
@@ 457-471 (lines=15) @@
454
		}
455
456
		// Restore assets into target environment
457
		if(in_array($dataTransfer->Mode, array('all', 'assets'))) {
458
			$log->write(sprintf('Restore of assets to "%s" started', $name));
459
			$args = array('data_path' => $workingDir . DIRECTORY_SEPARATOR . 'assets');
460
			$command = $this->getCommand('data:pushassets', 'web', $environment, $args, $log);
461
			$command->run(function($type, $buffer) use($log) {
462
				$log->write($buffer);
463
			});
464
			if(!$command->isSuccessful()) {
465
				$cleanupFn();
466
				$log->write(sprintf('Restore of assets to "%s" failed: %s', $name, $command->getErrorOutput()));
467
				$this->extend('dataTransferFailure', $environment, $log);
468
				throw new RuntimeException($command->getErrorOutput());
469
			}
470
			$log->write(sprintf('Restore of assets to "%s" done', $name));
471
		}
472
473
		$log->write('Rebuilding and cleaning up');
474
		$cleanupFn();