Code Duplication    Length = 13-13 lines in 2 locations

code/jobs/DataTransferJob.php 1 location

@@ 55-67 (lines=13) @@
52
				))
53
				->exclude('ID', $dataTransfer->ID);
54
55
			if($runningTransfers->count()) {
56
				$runningTransfer = $runningTransfers->first();
57
				$log->write(sprintf(
58
					'[-] Error: another transfer is in progress (started at %s by %s)',
59
					$runningTransfer->dbObject('Created')->Nice(),
60
					$runningTransfer->Author()->Title
61
				));
62
				throw new RuntimeException(sprintf(
63
					'Another transfer is in progress (started at %s by %s)',
64
					$runningTransfer->dbObject('Created')->Nice(),
65
					$runningTransfer->Author()->Title
66
				));
67
			}
68
69
70
			// before we push data to an environment, we'll make a backup first

code/jobs/DeployJob.php 1 location

@@ 103-115 (lines=13) @@
100
			// Disallow concurrent deployments (don't rely on queuing implementation to restrict this)
101
			// Only consider deployments started in the last 30 minutes (older jobs probably got stuck)
102
			$runningDeployments = $environment->runningDeployments()->exclude('ID', $this->args['deploymentID']);
103
			if($runningDeployments->count()) {
104
				$runningDeployment = $runningDeployments->first();
105
				$log->write(sprintf(
106
					'[-] Error: another deployment is in progress (started at %s by %s)',
107
					$runningDeployment->dbObject('Created')->Nice(),
108
					$runningDeployment->Deployer()->Title
109
				));
110
				throw new RuntimeException(sprintf(
111
					'Another deployment is in progress (started at %s by %s)',
112
					$runningDeployment->dbObject('Created')->Nice(),
113
					$runningDeployment->Deployer()->Title
114
				));
115
			}
116
117
			$environment->Backend()->deploy(
118
				$environment,