Code Duplication    Length = 15-15 lines in 2 locations

code/backends/CapistranoDeploymentBackend.php 2 locations

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