Code Duplication    Length = 15-15 lines in 2 locations

code/backends/CapistranoDeploymentBackend.php 2 locations

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