Completed
Push — master ( af71e2...aa56ac )
by Mateusz
05:50 queued 02:23
created
code/backends/CapistranoDeploymentBackend.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
 			try {
73 73
 				$args['build_filename'] = $this->packageGenerator->getPackageFilename($project->Name, $sha, $repository, $log);
74
-			} catch (Exception $e) {
74
+			} catch(Exception $e) {
75 75
 				$log->write($e->getMessage());
76 76
 				throw $e;
77 77
 			}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 			$this->extend('deployFailure', $environment, $sha, $log, $project);
110 110
 
111 111
 			$currentBuild = $environment->CurrentBuild();
112
-			if (empty($currentBuild) || (!empty($options['no_rollback']) && $options['no_rollback'] !== 'false')) {
112
+			if(empty($currentBuild) || (!empty($options['no_rollback']) && $options['no_rollback'] !== 'false')) {
113 113
 				throw new RuntimeException($command->getErrorOutput());
114 114
 			}
115 115
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 			// as deploying removes .htaccess
126 126
 			$this->enableMaintenance($environment, $log, $project);
127 127
 
128
-			if (!$command->isSuccessful() || !$this->smokeTest($environment, $log)) {
128
+			if(!$command->isSuccessful() || !$this->smokeTest($environment, $log)) {
129 129
 				$this->extend('deployRollbackFailure', $environment, $currentBuild->SHA, $log, $project);
130 130
 				$log->write('Rollback failed');
131 131
 				throw new RuntimeException($command->getErrorOutput());
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		} else {
204 204
 			$environment = $dataTransfer->Environment();
205 205
 			$project = $environment->Project();
206
-			$workingDir = TEMP_FOLDER . DIRECTORY_SEPARATOR . 'deploynaut-transfer-' . $dataTransfer->ID;
206
+			$workingDir = TEMP_FOLDER.DIRECTORY_SEPARATOR.'deploynaut-transfer-'.$dataTransfer->ID;
207 207
 			$archive = $dataTransfer->DataArchive();
208 208
 
209 209
 			// extract the sspak contents, we'll need these so capistrano can restore that content
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		if(!$args) {
250 250
 			$args = array();
251 251
 		}
252
-		$args['history_path'] = realpath(DEPLOYNAUT_LOG_PATH . '/');
252
+		$args['history_path'] = realpath(DEPLOYNAUT_LOG_PATH.'/');
253 253
 		$args['environment_id'] = $environment->ID;
254 254
 
255 255
 		// Inject env string directly into the command.
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 
265 265
 		$data = DNData::inst();
266 266
 		// Generate a capfile from a template
267
-		$capTemplate = file_get_contents(BASE_PATH . '/deploynaut/Capfile.template');
267
+		$capTemplate = file_get_contents(BASE_PATH.'/deploynaut/Capfile.template');
268 268
 		$cap = str_replace(
269 269
 			array('<config root>', '<ssh key>', '<base path>'),
270 270
 			array($data->getEnvironmentDir(), DEPLOYNAUT_SSH_KEY, BASE_PATH),
@@ -274,13 +274,13 @@  discard block
 block discarded – undo
274 274
 		if(defined('DEPLOYNAUT_CAPFILE')) {
275 275
 			$capFile = DEPLOYNAUT_CAPFILE;
276 276
 		} else {
277
-			$capFile = ASSETS_PATH . '/Capfile';
277
+			$capFile = ASSETS_PATH.'/Capfile';
278 278
 		}
279 279
 		file_put_contents($capFile, $cap);
280 280
 
281
-		$command = "{$envString}cap -f " . escapeshellarg($capFile) . " -vv $name $action ROLES=$roles";
281
+		$command = "{$envString}cap -f ".escapeshellarg($capFile)." -vv $name $action ROLES=$roles";
282 282
 		foreach($args as $argName => $argVal) {
283
-			$command .= ' -s ' . escapeshellarg($argName) . '=' . escapeshellarg($argVal);
283
+			$command .= ' -s '.escapeshellarg($argName).'='.escapeshellarg($argVal);
284 284
 		}
285 285
 
286 286
 		$log->write(sprintf('Running command: %s', $command));
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		$filepathBase = $dataArchive->generateFilepath($dataTransfer);
315 315
 		mkdir($filepathBase, 0700, true);
316 316
 
317
-		$databasePath = $filepathBase . DIRECTORY_SEPARATOR . 'database.sql';
317
+		$databasePath = $filepathBase.DIRECTORY_SEPARATOR.'database.sql';
318 318
 
319 319
 		// Backup database
320 320
 		if(in_array($dataTransfer->Mode, array('all', 'db'))) {
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 		$log->write('Creating sspak...');
353 353
 
354 354
 		$sspakFilename = sprintf('%s.sspak', $dataArchive->generateFilename($dataTransfer));
355
-		$sspakFilepath = $filepathBase . DIRECTORY_SEPARATOR . $sspakFilename;
355
+		$sspakFilepath = $filepathBase.DIRECTORY_SEPARATOR.$sspakFilename;
356 356
 
357 357
 		try {
358 358
 			$dataArchive->attachFile($sspakFilepath, $dataTransfer);
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		// Restore database into target environment
420 420
 		if(in_array($dataTransfer->Mode, array('all', 'db'))) {
421 421
 			$log->write(sprintf('Restore of database to "%s" started', $name));
422
-			$args = array('data_path' => $workingDir . DIRECTORY_SEPARATOR . 'database.sql');
422
+			$args = array('data_path' => $workingDir.DIRECTORY_SEPARATOR.'database.sql');
423 423
 			$command = $this->getCommand('data:pushdb', 'db', $environment, $args, $log);
424 424
 			$command->run(function($type, $buffer) use($log) {
425 425
 				$log->write($buffer);
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 		// Restore assets into target environment
437 437
 		if(in_array($dataTransfer->Mode, array('all', 'assets'))) {
438 438
 			$log->write(sprintf('Restore of assets to "%s" started', $name));
439
-			$args = array('data_path' => $workingDir . DIRECTORY_SEPARATOR . 'assets');
439
+			$args = array('data_path' => $workingDir.DIRECTORY_SEPARATOR.'assets');
440 440
 			$command = $this->getCommand('data:pushassets', 'web', $environment, $args, $log);
441 441
 			$command->run(function($type, $buffer) use($log) {
442 442
 				$log->write($buffer);
@@ -517,17 +517,17 @@  discard block
 block discarded – undo
517 517
 			}
518 518
 
519 519
 			// Produce an informational ticker roughly every $tick
520
-			if (time() > $infoTick) {
520
+			if(time() > $infoTick) {
521 521
 				$message = [];
522 522
 
523 523
 				// Collect status information from different sources.
524
-				if ($status) {
524
+				if($status) {
525 525
 					$message[] = sprintf('HTTP status code is %s', $status);
526 526
 				}
527
-				if (!$response) {
527
+				if(!$response) {
528 528
 					$message[] = 'response is empty';
529 529
 				}
530
-				if ($error = curl_error($ch)) {
530
+				if($error = curl_error($ch)) {
531 531
 					$message[] = sprintf('request error: %s', $error);
532 532
 				}
533 533
 
Please login to merge, or discard this patch.