Code Duplication    Length = 15-15 lines in 2 locations

code/backends/CapistranoDeploymentBackend.php 2 locations

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