Completed
Pull Request — master (#684)
by Stig
11:09 queued 05:06
created
code/control/DNRoot.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		Requirements::javascript('deploynaut/javascript/material.js');
180 180
 
181 181
 		// Load the buildable dependencies only if not loaded centrally.
182
-		if (!is_dir(BASE_PATH . DIRECTORY_SEPARATOR . 'static')) {
182
+		if (!is_dir(BASE_PATH.DIRECTORY_SEPARATOR.'static')) {
183 183
 			if (\Director::isDev()) {
184 184
 				\Requirements::javascript('deploynaut/static/bundle-debug.js');
185 185
 			} else {
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 		}
244 244
 
245 245
 		// Block framework jquery
246
-		Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
246
+		Requirements::block(FRAMEWORK_DIR.'/thirdparty/jquery/jquery.js');
247 247
 
248 248
 		self::include_requirements();
249 249
 	}
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @return \SS_HTTPResponse
263 263
 	 */
264 264
 	public function index(SS_HTTPRequest $request) {
265
-		return $this->redirect($this->Link() . 'projects/');
265
+		return $this->redirect($this->Link().'projects/');
266 266
 	}
267 267
 
268 268
 	/**
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 		// Framing an environment as a "group of people with download access"
391 391
 		// makes more sense to the user here, while still allowing us to enforce
392 392
 		// environment specific restrictions on downloading the file later on.
393
-		$envs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
393
+		$envs = $project->DNEnvironmentList()->filterByCallback(function($item) {
394 394
 			return $item->canUploadArchive();
395 395
 		});
396 396
 		$envsMap = [];
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 		$form->disableSecurityToken();
423 423
 		$form->addExtraClass('fields-wide');
424 424
 		// Tweak the action so it plays well with our fake URL structure.
425
-		$form->setFormAction($project->Link() . '/UploadSnapshotForm');
425
+		$form->setFormAction($project->Link().'/UploadSnapshotForm');
426 426
 
427 427
 		return $form;
428 428
 	}
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 		}
444 444
 
445 445
 		$validEnvs = $project->DNEnvironmentList()
446
-			->filterByCallback(function ($item) {
446
+			->filterByCallback(function($item) {
447 447
 				return $item->canUploadArchive();
448 448
 			});
449 449
 
@@ -472,9 +472,9 @@  discard block
 block discarded – undo
472 472
 		$dataArchive->DataTransfers()->add($dataTransfer);
473 473
 		$form->saveInto($dataArchive);
474 474
 		$dataArchive->write();
475
-		$workingDir = TEMP_FOLDER . DIRECTORY_SEPARATOR . 'deploynaut-transfer-' . $dataTransfer->ID;
475
+		$workingDir = TEMP_FOLDER.DIRECTORY_SEPARATOR.'deploynaut-transfer-'.$dataTransfer->ID;
476 476
 
477
-		$cleanupFn = function () use ($workingDir, $dataTransfer, $dataArchive) {
477
+		$cleanupFn = function() use ($workingDir, $dataTransfer, $dataArchive) {
478 478
 			$process = new AbortableProcess(sprintf('rm -rf %s', escapeshellarg($workingDir)));
479 479
 			$process->setTimeout(120);
480 480
 			$process->run();
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 		// Framing an environment as a "group of people with download access"
549 549
 		// makes more sense to the user here, while still allowing us to enforce
550 550
 		// environment specific restrictions on downloading the file later on.
551
-		$envs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
551
+		$envs = $project->DNEnvironmentList()->filterByCallback(function($item) {
552 552
 			return $item->canUploadArchive();
553 553
 		});
554 554
 		$envsMap = [];
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 		$form->disableSecurityToken();
575 575
 		$form->addExtraClass('fields-wide');
576 576
 		// Tweak the action so it plays well with our fake URL structure.
577
-		$form->setFormAction($project->Link() . '/PostSnapshotForm');
577
+		$form->setFormAction($project->Link().'/PostSnapshotForm');
578 578
 
579 579
 		return $form;
580 580
 	}
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 			return $this->project404Response();
594 594
 		}
595 595
 
596
-		$validEnvs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
596
+		$validEnvs = $project->DNEnvironmentList()->filterByCallback(function($item) {
597 597
 			return $item->canUploadArchive();
598 598
 		});
599 599
 
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 		$branchName = $request->getVar('name');
714 714
 		$branch = $project->DNBranchList()->byName($branchName);
715 715
 		if (!$branch) {
716
-			return new SS_HTTPResponse("Branch '" . Convert::raw2xml($branchName) . "' not found.", 404);
716
+			return new SS_HTTPResponse("Branch '".Convert::raw2xml($branchName)."' not found.", 404);
717 717
 		}
718 718
 
719 719
 		return $this->render([
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
 		);
851 851
 
852 852
 		// Tweak the action so it plays well with our fake URL structure.
853
-		$form->setFormAction($project->Link() . '/CreateEnvironmentForm');
853
+		$form->setFormAction($project->Link().'/CreateEnvironmentForm');
854 854
 
855 855
 		return $form;
856 856
 	}
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 		$job->write();
884 884
 		$job->start();
885 885
 
886
-		return $this->redirect($project->Link('createenv') . '/' . $job->ID);
886
+		return $this->redirect($project->Link('createenv').'/'.$job->ID);
887 887
 	}
888 888
 
889 889
 	/**
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
 			return $body;
1082 1082
 		}
1083 1083
 
1084
-		$form->setFormAction($this->getRequest()->getURL() . '/DeployForm');
1084
+		$form->setFormAction($this->getRequest()->getURL().'/DeployForm');
1085 1085
 		return $form;
1086 1086
 	}
1087 1087
 
@@ -1347,7 +1347,7 @@  discard block
 block discarded – undo
1347 1347
 		$deployment->getMachine()->apply(DNDeployment::TR_QUEUE);
1348 1348
 
1349 1349
 		return json_encode([
1350
-			'url' => Director::absoluteBaseURL() . $deployment->Link()
1350
+			'url' => Director::absoluteBaseURL().$deployment->Link()
1351 1351
 		], JSON_PRETTY_PRINT);
1352 1352
 	}
1353 1353
 
@@ -1470,7 +1470,7 @@  discard block
 block discarded – undo
1470 1470
 	 */
1471 1471
 	public function getDataTransferForm(SS_HTTPRequest $request = null) {
1472 1472
 		// Performs canView permission check by limiting visible projects
1473
-		$envs = $this->getCurrentProject()->DNEnvironmentList()->filterByCallback(function ($item) {
1473
+		$envs = $this->getCurrentProject()->DNEnvironmentList()->filterByCallback(function($item) {
1474 1474
 			return $item->canBackup();
1475 1475
 		});
1476 1476
 
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
 
1481 1481
 		$items = [];
1482 1482
 		$disabledEnvironments = [];
1483
-		foreach($envs as $env) {
1483
+		foreach ($envs as $env) {
1484 1484
 			$items[$env->ID] = $env->Title;
1485 1485
 			if ($env->CurrentBuild() === false) {
1486 1486
 				$items[$env->ID] = sprintf("%s - requires initial deployment", $env->Title);
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
 			}
1489 1489
 		}
1490 1490
 
1491
-		$envsField =  DropdownField::create('EnvironmentID', 'Environment', $items)
1491
+		$envsField = DropdownField::create('EnvironmentID', 'Environment', $items)
1492 1492
 			->setEmptyString('Select an environment');
1493 1493
 		$envsField->setDisabledItems($disabledEnvironments);
1494 1494
 
@@ -1509,7 +1509,7 @@  discard block
 block discarded – undo
1509 1509
 			),
1510 1510
 			FieldList::create($formAction)
1511 1511
 		);
1512
-		$form->setFormAction($this->getRequest()->getURL() . '/DataTransferForm');
1512
+		$form->setFormAction($this->getRequest()->getURL().'/DataTransferForm');
1513 1513
 
1514 1514
 		return $form;
1515 1515
 	}
@@ -1535,12 +1535,12 @@  discard block
 block discarded – undo
1535 1535
 		// Validate direction.
1536 1536
 		if ($data['Direction'] == 'get') {
1537 1537
 			$validEnvs = $this->getCurrentProject()->DNEnvironmentList()
1538
-				->filterByCallback(function ($item) {
1538
+				->filterByCallback(function($item) {
1539 1539
 					return $item->canBackup();
1540 1540
 				});
1541 1541
 		} else if ($data['Direction'] == 'push') {
1542 1542
 			$validEnvs = $this->getCurrentProject()->DNEnvironmentList()
1543
-				->filterByCallback(function ($item) {
1543
+				->filterByCallback(function($item) {
1544 1544
 					return $item->canRestore();
1545 1545
 				});
1546 1546
 		} else {
@@ -1671,7 +1671,7 @@  discard block
 block discarded – undo
1671 1671
 
1672 1672
 		// Performs canView permission check by limiting visible projects
1673 1673
 		$project = $this->getCurrentProject();
1674
-		$envs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
1674
+		$envs = $project->DNEnvironmentList()->filterByCallback(function($item) {
1675 1675
 			return $item->canRestore();
1676 1676
 		});
1677 1677
 
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
 
1697 1697
 		$items = [];
1698 1698
 		$disabledEnvironments = [];
1699
-		foreach($envs as $env) {
1699
+		foreach ($envs as $env) {
1700 1700
 			$items[$env->ID] = $env->Title;
1701 1701
 			if ($env->CurrentBuild() === false) {
1702 1702
 				$items[$env->ID] = sprintf("%s - requires initial deployment", $env->Title);
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
 			),
1726 1726
 			FieldList::create($formAction)
1727 1727
 		);
1728
-		$form->setFormAction($project->Link() . '/DataTransferRestoreForm');
1728
+		$form->setFormAction($project->Link().'/DataTransferRestoreForm');
1729 1729
 
1730 1730
 		return $form;
1731 1731
 	}
@@ -1823,7 +1823,7 @@  discard block
 block discarded – undo
1823 1823
 					->addExtraClass('btn')
1824 1824
 			)
1825 1825
 		);
1826
-		$form->setFormAction($project->Link() . '/DeleteForm');
1826
+		$form->setFormAction($project->Link().'/DeleteForm');
1827 1827
 
1828 1828
 		return $form;
1829 1829
 	}
@@ -1929,7 +1929,7 @@  discard block
 block discarded – undo
1929 1929
 					->addExtraClass('btn')
1930 1930
 			)
1931 1931
 		);
1932
-		$form->setFormAction($this->getCurrentProject()->Link() . '/MoveForm');
1932
+		$form->setFormAction($this->getCurrentProject()->Link().'/MoveForm');
1933 1933
 
1934 1934
 		return $form;
1935 1935
 	}
@@ -2190,7 +2190,7 @@  discard block
 block discarded – undo
2190 2190
 		$transfers = DNDataTransfer::get()
2191 2191
 			->filter('EnvironmentID', $environments)
2192 2192
 			->filterByCallback(
2193
-				function ($record) {
2193
+				function($record) {
2194 2194
 					return
2195 2195
 						$record->Environment()->canRestore() || // Ensure member can perform an action on the transfers env
2196 2196
 						$record->Environment()->canBackup() ||
@@ -2315,7 +2315,7 @@  discard block
 block discarded – undo
2315 2315
 	 */
2316 2316
 	protected function project404Response() {
2317 2317
 		return new SS_HTTPResponse(
2318
-			"Project '" . Convert::raw2xml($this->getRequest()->param('Project')) . "' not found.",
2318
+			"Project '".Convert::raw2xml($this->getRequest()->param('Project'))."' not found.",
2319 2319
 			404
2320 2320
 		);
2321 2321
 	}
@@ -2325,7 +2325,7 @@  discard block
 block discarded – undo
2325 2325
 	 */
2326 2326
 	protected function environment404Response() {
2327 2327
 		$envName = Convert::raw2xml($this->getRequest()->param('Environment'));
2328
-		return new SS_HTTPResponse("Environment '" . $envName . "' not found.", 404);
2328
+		return new SS_HTTPResponse("Environment '".$envName."' not found.", 404);
2329 2329
 	}
2330 2330
 
2331 2331
 	/**
Please login to merge, or discard this patch.