Code Duplication    Length = 15-15 lines in 2 locations

code/backends/CapistranoDeploymentBackend.php 2 locations

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