Code Duplication    Length = 15-15 lines in 2 locations

code/backends/CapistranoDeploymentBackend.php 2 locations

@@ 382-396 (lines=15) @@
379
		};
380
381
		// Restore database into target environment
382
		if(in_array($dataTransfer->Mode, array('all', 'db'))) {
383
			$log->write(sprintf('Restore of database to "%s" started', $name));
384
			$args = array('data_path' => $workingDir . DIRECTORY_SEPARATOR . 'database.sql');
385
			$command = $this->getCommand('data:pushdb', 'db', $environment, $args, $log);
386
			$command->run(function($type, $buffer) use($log) {
387
				$log->write($buffer);
388
			});
389
			if(!$command->isSuccessful()) {
390
				$cleanupFn();
391
				$log->write(sprintf('Restore of database to "%s" failed: %s', $name, $command->getErrorOutput()));
392
				$this->extend('dataTransferFailure', $environment, $log);
393
				throw new RuntimeException($command->getErrorOutput());
394
			}
395
			$log->write(sprintf('Restore of database to "%s" done', $name));
396
		}
397
398
		// Restore assets into target environment
399
		if(in_array($dataTransfer->Mode, array('all', 'assets'))) {
@@ 399-413 (lines=15) @@
396
		}
397
398
		// Restore assets into target environment
399
		if(in_array($dataTransfer->Mode, array('all', 'assets'))) {
400
			$log->write(sprintf('Restore of assets to "%s" started', $name));
401
			$args = array('data_path' => $workingDir . DIRECTORY_SEPARATOR . 'assets');
402
			$command = $this->getCommand('data:pushassets', 'web', $environment, $args, $log);
403
			$command->run(function($type, $buffer) use($log) {
404
				$log->write($buffer);
405
			});
406
			if(!$command->isSuccessful()) {
407
				$cleanupFn();
408
				$log->write(sprintf('Restore of assets to "%s" failed: %s', $name, $command->getErrorOutput()));
409
				$this->extend('dataTransferFailure', $environment, $log);
410
				throw new RuntimeException($command->getErrorOutput());
411
			}
412
			$log->write(sprintf('Restore of assets to "%s" done', $name));
413
		}
414
415
		$log->write('Rebuilding and cleaning up');
416
		$cleanupFn();