Completed
Push — master ( 7466ac...f7919c )
by Stig
01:27
created
code/control/DNRoot.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		Requirements::javascript('deploynaut/javascript/material.js');
178 178
 
179 179
 		// Load the buildable dependencies only if not loaded centrally.
180
-		if (!is_dir(BASE_PATH . DIRECTORY_SEPARATOR . 'static')) {
180
+		if (!is_dir(BASE_PATH.DIRECTORY_SEPARATOR.'static')) {
181 181
 			if (\Director::isDev()) {
182 182
 				\Requirements::javascript('deploynaut/static/bundle-debug.js');
183 183
 			} else {
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		}
221 221
 
222 222
 		// Block framework jquery
223
-		Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
223
+		Requirements::block(FRAMEWORK_DIR.'/thirdparty/jquery/jquery.js');
224 224
 
225 225
 		self::include_requirements();
226 226
 	}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * @return \SS_HTTPResponse
240 240
 	 */
241 241
 	public function index(\SS_HTTPRequest $request) {
242
-		return $this->redirect($this->Link() . 'projects/');
242
+		return $this->redirect($this->Link().'projects/');
243 243
 	}
244 244
 
245 245
 	/**
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 		// Framing an environment as a "group of people with download access"
368 368
 		// makes more sense to the user here, while still allowing us to enforce
369 369
 		// environment specific restrictions on downloading the file later on.
370
-		$envs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
370
+		$envs = $project->DNEnvironmentList()->filterByCallback(function($item) {
371 371
 			return $item->canUploadArchive();
372 372
 		});
373 373
 		$envsMap = [];
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 		$form->disableSecurityToken();
400 400
 		$form->addExtraClass('fields-wide');
401 401
 		// Tweak the action so it plays well with our fake URL structure.
402
-		$form->setFormAction($project->Link() . '/UploadSnapshotForm');
402
+		$form->setFormAction($project->Link().'/UploadSnapshotForm');
403 403
 
404 404
 		return $form;
405 405
 	}
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 		}
421 421
 
422 422
 		$validEnvs = $project->DNEnvironmentList()
423
-			->filterByCallback(function ($item) {
423
+			->filterByCallback(function($item) {
424 424
 				return $item->canUploadArchive();
425 425
 			});
426 426
 
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 		$dataArchive->DataTransfers()->add($dataTransfer);
450 450
 		$form->saveInto($dataArchive);
451 451
 		$dataArchive->write();
452
-		$workingDir = TEMP_FOLDER . DIRECTORY_SEPARATOR . 'deploynaut-transfer-' . $dataTransfer->ID;
452
+		$workingDir = TEMP_FOLDER.DIRECTORY_SEPARATOR.'deploynaut-transfer-'.$dataTransfer->ID;
453 453
 
454
-		$cleanupFn = function () use ($workingDir, $dataTransfer, $dataArchive) {
454
+		$cleanupFn = function() use ($workingDir, $dataTransfer, $dataArchive) {
455 455
 			$process = new AbortableProcess(sprintf('rm -rf %s', escapeshellarg($workingDir)));
456 456
 			$process->setTimeout(120);
457 457
 			$process->run();
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 		// Framing an environment as a "group of people with download access"
526 526
 		// makes more sense to the user here, while still allowing us to enforce
527 527
 		// environment specific restrictions on downloading the file later on.
528
-		$envs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
528
+		$envs = $project->DNEnvironmentList()->filterByCallback(function($item) {
529 529
 			return $item->canUploadArchive();
530 530
 		});
531 531
 		$envsMap = [];
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 		$form->disableSecurityToken();
552 552
 		$form->addExtraClass('fields-wide');
553 553
 		// Tweak the action so it plays well with our fake URL structure.
554
-		$form->setFormAction($project->Link() . '/PostSnapshotForm');
554
+		$form->setFormAction($project->Link().'/PostSnapshotForm');
555 555
 
556 556
 		return $form;
557 557
 	}
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 			return $this->project404Response();
571 571
 		}
572 572
 
573
-		$validEnvs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
573
+		$validEnvs = $project->DNEnvironmentList()->filterByCallback(function($item) {
574 574
 			return $item->canUploadArchive();
575 575
 		});
576 576
 
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 		$branchName = $request->getVar('name');
694 694
 		$branch = $project->DNBranchList()->byName($branchName);
695 695
 		if (!$branch) {
696
-			return new SS_HTTPResponse("Branch '" . Convert::raw2xml($branchName) . "' not found.", 404);
696
+			return new SS_HTTPResponse("Branch '".Convert::raw2xml($branchName)."' not found.", 404);
697 697
 		}
698 698
 
699 699
 		return $this->render([
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 		);
830 830
 
831 831
 		// Tweak the action so it plays well with our fake URL structure.
832
-		$form->setFormAction($project->Link() . '/CreateEnvironmentForm');
832
+		$form->setFormAction($project->Link().'/CreateEnvironmentForm');
833 833
 
834 834
 		return $form;
835 835
 	}
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 		$job->write();
863 863
 		$job->start();
864 864
 
865
-		return $this->redirect($project->Link('createenv') . '/' . $job->ID);
865
+		return $this->redirect($project->Link('createenv').'/'.$job->ID);
866 866
 	}
867 867
 
868 868
 	/**
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
 			return $body;
1040 1040
 		}
1041 1041
 
1042
-		$form->setFormAction($this->getRequest()->getURL() . '/DeployForm');
1042
+		$form->setFormAction($this->getRequest()->getURL().'/DeployForm');
1043 1043
 		return $form;
1044 1044
 	}
1045 1045
 
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
 		$deployment->getMachine()->apply(DNDeployment::TR_QUEUE);
1308 1308
 
1309 1309
 		return json_encode([
1310
-			'url' => Director::absoluteBaseURL() . $deployment->Link()
1310
+			'url' => Director::absoluteBaseURL().$deployment->Link()
1311 1311
 		], JSON_PRETTY_PRINT);
1312 1312
 	}
1313 1313
 
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
 	 */
1439 1439
 	public function getDataTransferForm(\SS_HTTPRequest $request = null) {
1440 1440
 		// Performs canView permission check by limiting visible projects
1441
-		$envs = $this->getCurrentProject()->DNEnvironmentList()->filterByCallback(function ($item) {
1441
+		$envs = $this->getCurrentProject()->DNEnvironmentList()->filterByCallback(function($item) {
1442 1442
 			return $item->canBackup();
1443 1443
 		});
1444 1444
 
@@ -1448,7 +1448,7 @@  discard block
 block discarded – undo
1448 1448
 
1449 1449
 		$items = [];
1450 1450
 		$disabledEnvironments = [];
1451
-		foreach($envs as $env) {
1451
+		foreach ($envs as $env) {
1452 1452
 			$items[$env->ID] = $env->Title;
1453 1453
 			if ($env->CurrentBuild() === false) {
1454 1454
 				$items[$env->ID] = sprintf("%s - requires initial deployment", $env->Title);
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
 			$fields,
1490 1490
 			FieldList::create($formAction)
1491 1491
 		);
1492
-		$form->setFormAction($this->getRequest()->getURL() . '/DataTransferForm');
1492
+		$form->setFormAction($this->getRequest()->getURL().'/DataTransferForm');
1493 1493
 
1494 1494
 		return $form;
1495 1495
 	}
@@ -1515,12 +1515,12 @@  discard block
 block discarded – undo
1515 1515
 		// Validate direction.
1516 1516
 		if ($data['Direction'] == 'get') {
1517 1517
 			$validEnvs = $this->getCurrentProject()->DNEnvironmentList()
1518
-				->filterByCallback(function ($item) {
1518
+				->filterByCallback(function($item) {
1519 1519
 					return $item->canBackup();
1520 1520
 				});
1521 1521
 		} else if ($data['Direction'] == 'push') {
1522 1522
 			$validEnvs = $this->getCurrentProject()->DNEnvironmentList()
1523
-				->filterByCallback(function ($item) {
1523
+				->filterByCallback(function($item) {
1524 1524
 					return $item->canRestore();
1525 1525
 				});
1526 1526
 		} else {
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
 
1653 1653
 		// Performs canView permission check by limiting visible projects
1654 1654
 		$project = $this->getCurrentProject();
1655
-		$envs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
1655
+		$envs = $project->DNEnvironmentList()->filterByCallback(function($item) {
1656 1656
 			return $item->canRestore();
1657 1657
 		});
1658 1658
 
@@ -1677,7 +1677,7 @@  discard block
 block discarded – undo
1677 1677
 
1678 1678
 		$items = [];
1679 1679
 		$disabledEnvironments = [];
1680
-		foreach($envs as $env) {
1680
+		foreach ($envs as $env) {
1681 1681
 			$items[$env->ID] = $env->Title;
1682 1682
 			if ($env->CurrentBuild() === false) {
1683 1683
 				$items[$env->ID] = sprintf("%s - requires initial deployment", $env->Title);
@@ -1707,7 +1707,7 @@  discard block
 block discarded – undo
1707 1707
 			),
1708 1708
 			FieldList::create($formAction)
1709 1709
 		);
1710
-		$form->setFormAction($project->Link() . '/DataTransferRestoreForm');
1710
+		$form->setFormAction($project->Link().'/DataTransferRestoreForm');
1711 1711
 
1712 1712
 		return $form;
1713 1713
 	}
@@ -1805,7 +1805,7 @@  discard block
 block discarded – undo
1805 1805
 					->addExtraClass('btn')
1806 1806
 			)
1807 1807
 		);
1808
-		$form->setFormAction($project->Link() . '/DeleteForm');
1808
+		$form->setFormAction($project->Link().'/DeleteForm');
1809 1809
 
1810 1810
 		return $form;
1811 1811
 	}
@@ -1911,7 +1911,7 @@  discard block
 block discarded – undo
1911 1911
 					->addExtraClass('btn')
1912 1912
 			)
1913 1913
 		);
1914
-		$form->setFormAction($this->getCurrentProject()->Link() . '/MoveForm');
1914
+		$form->setFormAction($this->getCurrentProject()->Link().'/MoveForm');
1915 1915
 
1916 1916
 		return $form;
1917 1917
 	}
@@ -2172,7 +2172,7 @@  discard block
 block discarded – undo
2172 2172
 		$transfers = DNDataTransfer::get()
2173 2173
 			->filter('EnvironmentID', $environments)
2174 2174
 			->filterByCallback(
2175
-				function ($record) {
2175
+				function($record) {
2176 2176
 					return
2177 2177
 						$record->Environment()->canRestore() || // Ensure member can perform an action on the transfers env
2178 2178
 						$record->Environment()->canBackup() ||
@@ -2297,7 +2297,7 @@  discard block
 block discarded – undo
2297 2297
 	 */
2298 2298
 	protected function project404Response() {
2299 2299
 		return new SS_HTTPResponse(
2300
-			"Project '" . Convert::raw2xml($this->getRequest()->param('Project')) . "' not found.",
2300
+			"Project '".Convert::raw2xml($this->getRequest()->param('Project'))."' not found.",
2301 2301
 			404
2302 2302
 		);
2303 2303
 	}
@@ -2307,7 +2307,7 @@  discard block
 block discarded – undo
2307 2307
 	 */
2308 2308
 	protected function environment404Response() {
2309 2309
 		$envName = Convert::raw2xml($this->getRequest()->param('Environment'));
2310
-		return new SS_HTTPResponse("Environment '" . $envName . "' not found.", 404);
2310
+		return new SS_HTTPResponse("Environment '".$envName."' not found.", 404);
2311 2311
 	}
2312 2312
 
2313 2313
 	/**
Please login to merge, or discard this patch.