Code Duplication    Length = 15-15 lines in 2 locations

code/backends/CapistranoDeploymentBackend.php 2 locations

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