Completed
Pull Request — master (#421)
by Michael
1346:13 queued 1341:51
created
code/jobs/PingJob.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 	 * Do the actual job by calling the appropiate backend
32 32
 	 */
33 33
 	public function perform() {
34
-		echo "[-] PingJob starting" . PHP_EOL;
34
+		echo "[-] PingJob starting".PHP_EOL;
35 35
 		$log = new DeploynautLogFile($this->args['logfile']);
36 36
 
37 37
 		$ping = DNPing::get()->byID($this->args['pingID']);
Please login to merge, or discard this patch.
code/jobs/DataTransferJob.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	}
21 21
 
22 22
 	public function perform() {
23
-		echo "[-] DataTransferJob starting" . PHP_EOL;
23
+		echo "[-] DataTransferJob starting".PHP_EOL;
24 24
 		$log = new DeploynautLogFile($this->args['logfile']);
25 25
 		$dataTransfer = DNDataTransfer::get()->byID($this->args['dataTransferID']);
26 26
 		$environment = $dataTransfer->Environment();
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 		} catch(RuntimeException $exc) {
84 84
 			$log->write($exc->getMessage());
85 85
 
86
-			echo "[-] DataTransferJob failed" . PHP_EOL;
86
+			echo "[-] DataTransferJob failed".PHP_EOL;
87 87
 			throw $exc;
88 88
 		}
89 89
 
90 90
 		$this->updateStatus('Finished');
91
-		echo "[-] DataTransferJob finished" . PHP_EOL;
91
+		echo "[-] DataTransferJob finished".PHP_EOL;
92 92
 	}
93 93
 
94 94
 	/**
Please login to merge, or discard this patch.
code/jobs/CloneGitRepo.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 		$path = $this->args['path'];
19 19
 		$repo = $this->args['repo'];
20 20
 		$env = $this->args['env'];
21
-		$logfile = DEPLOYNAUT_LOG_PATH . '/clonegitrepo.log';
21
+		$logfile = DEPLOYNAUT_LOG_PATH.'/clonegitrepo.log';
22 22
 		$fh = fopen($logfile, 'a');
23 23
 		if(!$fh) {
24 24
 			throw new RuntimeException(sprintf('Can\'t open file "%s" for logging.', $logfile));
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 			}
35 35
 			$command[] = sprintf('rm -rf %s', $path);
36 36
 
37
-			fwrite($fh, sprintf('[%s] Cleaning up existing repository %s', date('Y-m-d H:i:s'), $path) . PHP_EOL);
38
-			fwrite($fh, sprintf('[%s] Running command: %s', date('Y-m-d H:i:s'), implode(' ', $command)) . PHP_EOL);
37
+			fwrite($fh, sprintf('[%s] Cleaning up existing repository %s', date('Y-m-d H:i:s'), $path).PHP_EOL);
38
+			fwrite($fh, sprintf('[%s] Running command: %s', date('Y-m-d H:i:s'), implode(' ', $command)).PHP_EOL);
39 39
 
40 40
 			$process = new \Symfony\Component\Process\Process(implode(' ', $command));
41 41
 			$process->setEnv($env);
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 					'[%s] Error cleaning up existing repository: %s',
47 47
 					date('Y-m-d H:i:s'),
48 48
 					$process->getErrorOutput()
49
-				) . PHP_EOL);
49
+				).PHP_EOL);
50 50
 				throw new RuntimeException($process->getErrorOutput());
51 51
 			}
52 52
 		}
53 53
 
54
-		fwrite($fh, sprintf('[%s] Cloning repository %s to %s', date('Y-m-d H:i:s'), $repo, $path) . PHP_EOL);
55
-		echo "[-] CloneGitRepo starting" . PHP_EOL;
54
+		fwrite($fh, sprintf('[%s] Cloning repository %s to %s', date('Y-m-d H:i:s'), $repo, $path).PHP_EOL);
55
+		echo "[-] CloneGitRepo starting".PHP_EOL;
56 56
 
57 57
 		$command = array();
58 58
 		if(!empty($user)) {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		}
61 61
 		$command[] = sprintf('git clone --bare -q %s %s', $repo, $path);
62 62
 
63
-		fwrite($fh, sprintf('[%s] Running command: %s', date('Y-m-d H:i:s'), implode(' ', $command)) . PHP_EOL);
63
+		fwrite($fh, sprintf('[%s] Running command: %s', date('Y-m-d H:i:s'), implode(' ', $command)).PHP_EOL);
64 64
 
65 65
 		$process = new \Symfony\Component\Process\Process(implode(' ', $command));
66 66
 		$process->setEnv($env);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 				$repo,
74 74
 				$path,
75 75
 				$process->getErrorOutput()
76
-			) . PHP_EOL);
76
+			).PHP_EOL);
77 77
 			throw new RuntimeException($process->getErrorOutput());
78 78
 		}
79 79
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			date('Y-m-d H:i:s'),
83 83
 			$repo,
84 84
 			$path
85
-		) . PHP_EOL);
85
+		).PHP_EOL);
86 86
 	}
87 87
 
88 88
 }
Please login to merge, or discard this patch.
code/jobs/FetchJob.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 		$path = $project->getLocalCVSPath();
24 24
 		$env = $this->args['env'];
25 25
 
26
-		$log->write('Starting git fetch for project "' . $project->Name . '"');
26
+		$log->write('Starting git fetch for project "'.$project->Name.'"');
27 27
 
28 28
 		// if an alternate user has been configured for clone, run the command as that user
29 29
 		// @todo Gitonomy doesn't seem to have any way to prefix the command properly, if you
Please login to merge, or discard this patch.
code/model/DNProject.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @return bool
257 257
 	 */
258 258
 	public function canRestore($member = null) {
259
-		if ($this->allowedAny(
259
+		if($this->allowedAny(
260 260
 			array(
261 261
 				DNRoot::ALLOW_PROD_SNAPSHOT,
262 262
 				DNRoot::ALLOW_NON_PROD_SNAPSHOT
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 * @return bool
277 277
 	 */
278 278
 	public function canBackup($member = null) {
279
-		if ($this->allowedAny(
279
+		if($this->allowedAny(
280 280
 			array(
281 281
 				DNRoot::ALLOW_PROD_SNAPSHOT,
282 282
 				DNRoot::ALLOW_NON_PROD_SNAPSHOT
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	 * @return bool
297 297
 	 */
298 298
 	public function canUploadArchive($member = null) {
299
-		if ($this->allowedAny(
299
+		if($this->allowedAny(
300 300
 			array(
301 301
 				DNRoot::ALLOW_PROD_SNAPSHOT,
302 302
 				DNRoot::ALLOW_NON_PROD_SNAPSHOT
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	 * @return bool
317 317
 	 */
318 318
 	public function canDownloadArchive($member = null) {
319
-		if ($this->allowedAny(
319
+		if($this->allowedAny(
320 320
 			array(
321 321
 				DNRoot::ALLOW_PROD_SNAPSHOT,
322 322
 				DNRoot::ALLOW_NON_PROD_SNAPSHOT
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 			// Key-pair is available, use it.
386 386
 			$processEnv = array(
387 387
 				'IDENT_KEY' => $this->getPrivateKeyPath(),
388
-				'GIT_SSH' => BASE_PATH . "/deploynaut/git-deploy.sh"
388
+				'GIT_SSH' => BASE_PATH."/deploynaut/git-deploy.sh"
389 389
 			);
390 390
 		} else {
391 391
 			$processEnv = array();
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	 * @return bool
647 647
 	 */
648 648
 	public function repoExists() {
649
-		return file_exists(DEPLOYNAUT_LOCAL_VCS_PATH . '/' . $this->Name.'/HEAD');
649
+		return file_exists(DEPLOYNAUT_LOCAL_VCS_PATH.'/'.$this->Name.'/HEAD');
650 650
 	}
651 651
 
652 652
 	/**
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	 * @return string
665 665
 	 */
666 666
 	public function getLocalCVSPath() {
667
-		return DEPLOYNAUT_LOCAL_VCS_PATH . '/' . $this->Name;
667
+		return DEPLOYNAUT_LOCAL_VCS_PATH.'/'.$this->Name;
668 668
 	}
669 669
 
670 670
 	/**
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 	 */
741 741
 	public function getPublicKeyPath() {
742 742
 		if($privateKey = $this->getPrivateKeyPath()) {
743
-			return $privateKey . '.pub';
743
+			return $privateKey.'.pub';
744 744
 		}
745 745
 		return null;
746 746
 	}
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 		if(!empty($keyDir)) {
756 756
 			$filter = FileNameFilter::create();
757 757
 			$name = $filter->filter($this->Name);
758
-			return $keyDir . '/' . $name;
758
+			return $keyDir.'/'.$name;
759 759
 		}
760 760
 		return null;
761 761
 	}
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 		$filter = FileNameFilter::create();
775 775
 		$name = $filter->filter($this->Name);
776 776
 
777
-		return $this->DNData()->getKeyDir() . '/' . $name;
777
+		return $this->DNData()->getKeyDir().'/'.$name;
778 778
 	}
779 779
 
780 780
 	/**
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 		/* Look for each whitelisted hostname */
862 862
 		foreach($interfaces as $host => $interface) {
863 863
 			/* See if the CVS Path is for this hostname, followed by some junk (maybe a port), then the path */
864
-			if(preg_match('{^[^.]*' . $host . '(.*?)([/a-zA-Z].+)}', $this->CVSPath, $match)) {
864
+			if(preg_match('{^[^.]*'.$host.'(.*?)([/a-zA-Z].+)}', $this->CVSPath, $match)) {
865 865
 
866 866
 				$path = $match[2];
867 867
 
@@ -872,10 +872,10 @@  discard block
 block discarded – undo
872 872
 				$components = explode('.', $host);
873 873
 
874 874
 				foreach($regex as $pattern => $replacement) {
875
-					$path = preg_replace('/' . $pattern . '/', $replacement, $path);
875
+					$path = preg_replace('/'.$pattern.'/', $replacement, $path);
876 876
 				}
877 877
 
878
-				$uxurl = Controller::join_links($scheme . '://', $host, $path);
878
+				$uxurl = Controller::join_links($scheme.'://', $host, $path);
879 879
 
880 880
 				if(array_key_exists('commit', $interface) && $interface['commit'] == false) {
881 881
 					$commiturl = false;
@@ -959,14 +959,14 @@  discard block
 block discarded – undo
959 959
 	 * @return bool
960 960
 	 */
961 961
 	public function allowedAny($codes, $member = null) {
962
-		if (!$member) {
962
+		if(!$member) {
963 963
 			$member = Member::currentUser();
964 964
 		}
965 965
 
966 966
 		if(Permission::checkMember($member, 'ADMIN')) return true;
967 967
 
968 968
 		$hits = $this->whoIsAllowedAny($codes)->filter('Member.ID', $member->ID)->count();
969
-		return ($hits>0 ? true : false);
969
+		return ($hits > 0 ? true : false);
970 970
 	}
971 971
 
972 972
 }
Please login to merge, or discard this patch.
code/api/nouns/APIProject.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,9 +87,9 @@
 block discarded – undo
87 87
 		$fetch->write();
88 88
 		$fetch->start();
89 89
 
90
-		$location = Director::absoluteBaseURL() . $this->Link() . '/fetch/' . $fetch->ID;
90
+		$location = Director::absoluteBaseURL().$this->Link().'/fetch/'.$fetch->ID;
91 91
 		$output = array(
92
-			'message' => 'Ping queued as job ' . $fetch->ResqueToken,
92
+			'message' => 'Ping queued as job '.$fetch->ResqueToken,
93 93
 			'href' => $location,
94 94
 		);
95 95
 
Please login to merge, or discard this patch.
code/control/DNRoot.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 			)
186 186
 		);
187 187
 
188
-		if (\Director::isDev()) {
188
+		if(\Director::isDev()) {
189 189
 			\Requirements::javascript('deploynaut/static/bundle-debug.js');
190 190
 		} else {
191 191
 			\Requirements::javascript('deploynaut/static/bundle.js');
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 		}
248 248
 
249 249
 		// Block framework jquery
250
-		Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
250
+		Requirements::block(FRAMEWORK_DIR.'/thirdparty/jquery/jquery.js');
251 251
 
252 252
 		self::include_requirements();
253 253
 	}
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 * @return \SS_HTTPResponse
267 267
 	 */
268 268
 	public function index(SS_HTTPRequest $request) {
269
-		return $this->redirect($this->Link() . 'projects/');
269
+		return $this->redirect($this->Link().'projects/');
270 270
 	}
271 271
 
272 272
 	/**
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 		$form->disableSecurityToken();
425 425
 		$form->addExtraClass('fields-wide');
426 426
 		// Tweak the action so it plays well with our fake URL structure.
427
-		$form->setFormAction($project->Link() . '/UploadSnapshotForm');
427
+		$form->setFormAction($project->Link().'/UploadSnapshotForm');
428 428
 
429 429
 		return $form;
430 430
 	}
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 		$dataArchive->DataTransfers()->add($dataTransfer);
475 475
 		$form->saveInto($dataArchive);
476 476
 		$dataArchive->write();
477
-		$workingDir = TEMP_FOLDER . DIRECTORY_SEPARATOR . 'deploynaut-transfer-' . $dataTransfer->ID;
477
+		$workingDir = TEMP_FOLDER.DIRECTORY_SEPARATOR.'deploynaut-transfer-'.$dataTransfer->ID;
478 478
 
479 479
 		$cleanupFn = function() use($workingDir, $dataTransfer, $dataArchive) {
480 480
 			$process = new Process(sprintf('rm -rf %s', escapeshellarg($workingDir)));
@@ -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
 	}
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 		$branchName = $request->getVar('name');
713 713
 		$branch = $project->DNBranchList()->byName($branchName);
714 714
 		if(!$branch) {
715
-			return new SS_HTTPResponse("Branch '" . Convert::raw2xml($branchName) . "' not found.", 404);
715
+			return new SS_HTTPResponse("Branch '".Convert::raw2xml($branchName)."' not found.", 404);
716 716
 		}
717 717
 
718 718
 		return $this->render(array(
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 		);
947 947
 
948 948
 		// Tweak the action so it plays well with our fake URL structure.
949
-		$form->setFormAction($project->Link() . '/CreateEnvironmentForm');
949
+		$form->setFormAction($project->Link().'/CreateEnvironmentForm');
950 950
 
951 951
 		return $form;
952 952
 	}
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
 		$job->write();
980 980
 		$job->start();
981 981
 
982
-		return $this->redirect($project->Link('createenv') . '/' . $job->ID);
982
+		return $this->redirect($project->Link('createenv').'/'.$job->ID);
983 983
 	}
984 984
 
985 985
 	/**
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
 	 */
1038 1038
 	public function getPlatformSpecificStrings() {
1039 1039
 		$strings = $this->config()->platform_specific_strings;
1040
-		if ($strings) {
1040
+		if($strings) {
1041 1041
 			return new ArrayList($strings);
1042 1042
 		}
1043 1043
 	}
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
 			return $body;
1162 1162
 		}
1163 1163
 
1164
-		$form->setFormAction($this->getRequest()->getURL() . '/DeployForm');
1164
+		$form->setFormAction($this->getRequest()->getURL().'/DeployForm');
1165 1165
 		return $form;
1166 1166
 	}
1167 1167
 
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
 		$deployment->start();
1436 1436
 
1437 1437
 		return json_encode(array(
1438
-			'url' => Director::absoluteBaseURL() . $deployment->Link()
1438
+			'url' => Director::absoluteBaseURL().$deployment->Link()
1439 1439
 		), JSON_PRETTY_PRINT);
1440 1440
 	}
1441 1441
 
@@ -1542,7 +1542,7 @@  discard block
 block discarded – undo
1542 1542
 					->addExtraClass('btn')
1543 1543
 			)
1544 1544
 		);
1545
-		$form->setFormAction($this->getRequest()->getURL() . '/DataTransferForm');
1545
+		$form->setFormAction($this->getRequest()->getURL().'/DataTransferForm');
1546 1546
 
1547 1547
 		return $form;
1548 1548
 	}
@@ -1744,7 +1744,7 @@  discard block
 block discarded – undo
1744 1744
 					->addExtraClass('btn')
1745 1745
 			)
1746 1746
 		);
1747
-		$form->setFormAction($project->Link() . '/DataTransferRestoreForm');
1747
+		$form->setFormAction($project->Link().'/DataTransferRestoreForm');
1748 1748
 
1749 1749
 		return $form;
1750 1750
 	}
@@ -1842,7 +1842,7 @@  discard block
 block discarded – undo
1842 1842
 					->addExtraClass('btn')
1843 1843
 			)
1844 1844
 		);
1845
-		$form->setFormAction($project->Link() . '/DeleteForm');
1845
+		$form->setFormAction($project->Link().'/DeleteForm');
1846 1846
 
1847 1847
 		return $form;
1848 1848
 	}
@@ -1948,7 +1948,7 @@  discard block
 block discarded – undo
1948 1948
 					->addExtraClass('btn')
1949 1949
 			)
1950 1950
 		);
1951
-		$form->setFormAction($this->getCurrentProject()->Link() . '/MoveForm');
1951
+		$form->setFormAction($this->getCurrentProject()->Link().'/MoveForm');
1952 1952
 
1953 1953
 		return $form;
1954 1954
 	}
@@ -2247,7 +2247,7 @@  discard block
 block discarded – undo
2247 2247
 	 */
2248 2248
 	protected function project404Response() {
2249 2249
 		return new SS_HTTPResponse(
2250
-			"Project '" . Convert::raw2xml($this->getRequest()->param('Project')) . "' not found.",
2250
+			"Project '".Convert::raw2xml($this->getRequest()->param('Project'))."' not found.",
2251 2251
 			404
2252 2252
 		);
2253 2253
 	}
@@ -2257,7 +2257,7 @@  discard block
 block discarded – undo
2257 2257
 	 */
2258 2258
 	protected function environment404Response() {
2259 2259
 		$envName = Convert::raw2xml($this->getRequest()->param('Environment'));
2260
-		return new SS_HTTPResponse("Environment '" . $envName . "' not found.", 404);
2260
+		return new SS_HTTPResponse("Environment '".$envName."' not found.", 404);
2261 2261
 	}
2262 2262
 
2263 2263
 	/**
@@ -2326,7 +2326,7 @@  discard block
 block discarded – undo
2326 2326
 	public function AmbientMenu() {
2327 2327
 		$list = new ArrayList();
2328 2328
 
2329
-		if (Member::currentUserID()) {
2329
+		if(Member::currentUserID()) {
2330 2330
 			$list->push(new ArrayData(array(
2331 2331
 				'Classes' => 'logout',
2332 2332
 				'FaIcon' => 'sign-out',
@@ -2432,7 +2432,7 @@  discard block
 block discarded – undo
2432 2432
 			} else {
2433 2433
 				$form->sessionMessage('Unable to write the project to the database.', 'bad');
2434 2434
 			}
2435
-		} catch (ValidationException $e) {
2435
+		} catch(ValidationException $e) {
2436 2436
 			$form->sessionMessage($e->getMessage(), 'bad');
2437 2437
 		}
2438 2438
 		return $this->redirectBack();
Please login to merge, or discard this patch.
code/jobs/CreateEnvJob.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@
 block discarded – undo
40 40
 
41 41
 		} catch(Exception $e) {
42 42
 			$this->updateStatus('Failed');
43
-			echo "[-] CreateEnvJob failed" . PHP_EOL;
43
+			echo "[-] CreateEnvJob failed".PHP_EOL;
44 44
 			throw $e;
45 45
 		}
46
-		echo "[-] CreateEnvJob finished" . PHP_EOL;
46
+		echo "[-] CreateEnvJob finished".PHP_EOL;
47 47
 	}
48 48
 
49 49
 	/**
Please login to merge, or discard this patch.