Code Duplication    Length = 15-15 lines in 2 locations

code/backends/CapistranoDeploymentBackend.php 2 locations

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