Code Duplication    Length = 12-12 lines in 2 locations

code/jobs/DataTransferJob.php 1 location

@@ 29-40 (lines=12) @@
26
		$environment = $dataTransfer->Environment();
27
		$backupDataTransfer = null;
28
29
		if(!empty($this->args['backupBeforePush']) && $dataTransfer->Direction == 'push') {
30
			$backupDataTransfer = DNDataTransfer::create();
31
			$backupDataTransfer->EnvironmentID = $environment->ID;
32
			$backupDataTransfer->Direction = 'get';
33
			$backupDataTransfer->Mode = $dataTransfer->Mode;
34
			$backupDataTransfer->ResqueToken = $dataTransfer->ResqueToken;
35
			$backupDataTransfer->AuthorID = $dataTransfer->AuthorID;
36
			$backupDataTransfer->write();
37
38
			$dataTransfer->BackupDataTransferID = $backupDataTransfer->ID;
39
			$dataTransfer->write();
40
		}
41
42
		// This is a bit icky, but there is no easy way of capturing a failed run by using the PHP Resque
43
		try {

code/jobs/DeployJob.php 1 location

@@ 90-101 (lines=12) @@
87
		// the deploy job, so that the order of backup is done before deployment, and so it
88
		// doesn't tie up another worker. It also puts the backup output into
89
		// the same log as the deployment so there is visibility on what is going on.
90
		if(!empty($this->args['predeploy_backup'])) {
91
			$backupDataTransfer = DNDataTransfer::create();
92
			$backupDataTransfer->EnvironmentID = $environment->ID;
93
			$backupDataTransfer->Direction = 'get';
94
			$backupDataTransfer->Mode = $backupMode;
95
			$backupDataTransfer->ResqueToken = $deployment->ResqueToken;
96
			$backupDataTransfer->AuthorID = $deployment->DeployerID;
97
			$backupDataTransfer->write();
98
99
			$deployment->BackupDataTransferID = $backupDataTransfer->ID;
100
			$deployment->write();
101
		}
102
103
		// This is a bit icky, but there is no easy way of capturing a failed deploy by using the PHP Resque
104
		try {