Completed
Pull Request — master (#488)
by Helpful
1295:51 queued 1292:33
created
code/model/DNEnvironment.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
 		}
409 409
 		// Must be logged in to check permissions
410 410
 
411
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
412
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_DEPLOYMENT, $member)) return true;
411
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
412
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_DEPLOYMENT, $member)) return true;
413 413
 		} else {
414
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_DEPLOYMENT, $member)) return true;
414
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_DEPLOYMENT, $member)) return true;
415 415
 		}
416 416
 
417 417
 		return $this->Deployers()->byID($member->ID)
@@ -443,10 +443,10 @@  discard block
 block discarded – undo
443 443
 		}
444 444
 		// Must be logged in to check permissions
445 445
 
446
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
447
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
446
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
447
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
448 448
 		} else {
449
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
449
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
450 450
 		}
451 451
 
452 452
 		return $this->CanRestoreMembers()->byID($member->ID)
@@ -474,10 +474,10 @@  discard block
 block discarded – undo
474 474
 			return false;
475 475
 		}
476 476
 
477
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
478
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
477
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
478
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
479 479
 		} else {
480
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
480
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
481 481
 		}
482 482
 
483 483
 		return $this->CanBackupMembers()->byID($member->ID)
@@ -509,10 +509,10 @@  discard block
 block discarded – undo
509 509
 		}
510 510
 		// Must be logged in to check permissions
511 511
 
512
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
513
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
512
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
513
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
514 514
 		} else {
515
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
515
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
516 516
 		}
517 517
 
518 518
 		return $this->ArchiveUploaders()->byID($member->ID)
@@ -535,10 +535,10 @@  discard block
 block discarded – undo
535 535
 		}
536 536
 		// Must be logged in to check permissions
537 537
 
538
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
539
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
538
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
539
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
540 540
 		} else {
541
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
541
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
542 542
 		}
543 543
 
544 544
 		return $this->ArchiveDownloaders()->byID($member->ID)
@@ -604,10 +604,10 @@  discard block
 block discarded – undo
604 604
 		}
605 605
 		// Must be logged in to check permissions
606 606
 
607
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
608
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
607
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
608
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
609 609
 		} else {
610
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
610
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
611 611
 		}
612 612
 
613 613
 		return $this->ArchiveDeleters()->byID($member->ID)
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 	 * @return string
828 828
 	 */
829 829
 	public function Link() {
830
-		return $this->Project()->Link() . "/environment/" . $this->Name;
830
+		return $this->Project()->Link()."/environment/".$this->Name;
831 831
 	}
832 832
 
833 833
 	/**
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 				->buildPermissionField('ArchiveUploaderGroups', 'ArchiveUploaders', $groups, $members)
973 973
 				->setTitle('Who can upload?')
974 974
 				->setDescription(
975
-					'Users who can upload archives linked to this environment into Deploynaut.<br />' .
975
+					'Users who can upload archives linked to this environment into Deploynaut.<br />'.
976 976
 					'Linking them to an environment allows limiting download permissions (see below).'
977 977
 				),
978 978
 
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
 		// Add actions
1045 1045
 		$action = new FormAction('check', 'Check Connection');
1046 1046
 		$action->setUseButtonTag(true);
1047
-		$dataURL = Director::absoluteBaseURL() . 'naut/api/' . $this->Project()->Name . '/' . $this->Name . '/ping';
1047
+		$dataURL = Director::absoluteBaseURL().'naut/api/'.$this->Project()->Name.'/'.$this->Name.'/ping';
1048 1048
 		$action->setAttribute('data-url', $dataURL);
1049 1049
 		$fields->insertBefore($action, 'Name');
1050 1050
 
@@ -1110,8 +1110,8 @@  discard block
 block discarded – undo
1110 1110
 	 */
1111 1111
 	public function onBeforeWrite() {
1112 1112
 		parent::onBeforeWrite();
1113
-		if($this->Name && $this->Name . '.rb' != $this->Filename) {
1114
-			$this->Filename = $this->Name . '.rb';
1113
+		if($this->Name && $this->Name.'.rb' != $this->Filename) {
1114
+			$this->Filename = $this->Name.'.rb';
1115 1115
 		}
1116 1116
 		$this->checkEnvironmentPath();
1117 1117
 		$this->writeConfigFile();
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 			&& $this->Filename
1160 1160
 			&& $this->CreateEnvConfig
1161 1161
 		) {
1162
-			$templateFile = $this->config()->template_file ?: BASE_PATH . '/deploynaut/environment.template';
1162
+			$templateFile = $this->config()->template_file ?: BASE_PATH.'/deploynaut/environment.template';
1163 1163
 			file_put_contents($this->getConfigFilename(), file_get_contents($templateFile));
1164 1164
 		} else if($this->envFileExists() && $this->DeployConfig) {
1165 1165
 			file_put_contents($this->getConfigFilename(), $this->DeployConfig);
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
 		if(!$this->Filename) {
1232 1232
 			return '';
1233 1233
 		}
1234
-		return $this->DNData()->getEnvironmentDir() . '/' . $this->Project()->Name . '/' . $this->Filename;
1234
+		return $this->DNData()->getEnvironmentDir().'/'.$this->Project()->Name.'/'.$this->Filename;
1235 1235
 	}
1236 1236
 
1237 1237
 	/**
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
 		}
1248 1248
 		$path = pathinfo($name);
1249 1249
 		if($path) {
1250
-			return $path['dirname'] . '/' . $path['filename'] . '.yml';
1250
+			return $path['dirname'].'/'.$path['filename'].'.yml';
1251 1251
 		}
1252 1252
 	}
1253 1253
 
Please login to merge, or discard this patch.
code/model/DNBranch.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 
56 56
 	public function Link() {
57 57
 		// Use a get-var for branch so that it can handle unsafe chars better
58
-		return Controller::join_links($this->project->Link(), 'branch?name=' . urlencode($this->Name()));
58
+		return Controller::join_links($this->project->Link(), 'branch?name='.urlencode($this->Name()));
59 59
 	}
60 60
 
61 61
 	/**
Please login to merge, or discard this patch.
code/model/DNData.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function setEnvironmentDir($environmentDir) {
83 83
 		if($environmentDir[0] != "/") {
84
-			$environmentDir = BASE_PATH . '/' . $environmentDir;
84
+			$environmentDir = BASE_PATH.'/'.$environmentDir;
85 85
 		}
86 86
 		$this->environmentDir = realpath($environmentDir) ?: $environmentDir;
87 87
 	}
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function setKeyDir($keyDir) {
104 104
 		if($keyDir[0] != "/") {
105
-			$keyDir = BASE_PATH . '/' . $keyDir;
105
+			$keyDir = BASE_PATH.'/'.$keyDir;
106 106
 		}
107 107
 		$this->keyDir = realpath($keyDir) ?: $keyDir;
108 108
 	}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function setDataTransferDir($transferDir) {
146 146
 		if($transferDir[0] != "/") {
147
-			$transferDir = BASE_PATH . '/' . $transferDir;
147
+			$transferDir = BASE_PATH.'/'.$transferDir;
148 148
 		}
149 149
 		if(strpos($transferDir, ASSETS_PATH) === false) {
150 150
 			throw new LogicException(sprintf(
@@ -174,14 +174,14 @@  discard block
 block discarded – undo
174 174
 	public function getProjectPaths() {
175 175
 		$paths = array();
176 176
 		if(!file_exists($this->getEnvironmentDir())) {
177
-			$eMessage = 'The environment directory ' . $this->getEnvironmentDir() . ' doesn\'t exist. Create it '
177
+			$eMessage = 'The environment directory '.$this->getEnvironmentDir().' doesn\'t exist. Create it '
178 178
 			. 'first and add some projects to it.';
179 179
 			throw new Exception($eMessage);
180 180
 		}
181 181
 		foreach(scandir($this->getEnvironmentDir()) as $project) {
182 182
 			// Exlcude dot-prefixed directories (.git was getting in the way)
183 183
 			if(preg_match('/^[^\.]/', $project)) {
184
-				$path = $this->getEnvironmentDir() . '/' . $project;
184
+				$path = $this->getEnvironmentDir().'/'.$project;
185 185
 				if(is_dir($path) && $project != '.' && $project != '..') {
186 186
 					$paths[] = $project;
187 187
 				}
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 	 * Returns an array of paths
197 197
 	 */
198 198
 	public function getEnvironmentPaths($project) {
199
-		$baseDir = $this->getEnvironmentDir() . '/' . $project;
199
+		$baseDir = $this->getEnvironmentDir().'/'.$project;
200 200
 
201 201
 		$paths = array();
202 202
 		if(!file_exists($baseDir)) {
203
-			throw new Exception('Environment directory ' . $baseDir . ' doesn\'t exist. Create it first.');
203
+			throw new Exception('Environment directory '.$baseDir.' doesn\'t exist. Create it first.');
204 204
 		}
205 205
 		// Search the directory for config files.
206 206
 		foreach(scandir($baseDir) as $environmentFile) {
Please login to merge, or discard this patch.
code/model/jobs/DNPing.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 	 * @return string
38 38
 	 */
39 39
 	public function LogLink() {
40
-		return $this->Link() . '/log';
40
+		return $this->Link().'/log';
41 41
 	}
42 42
 
43 43
 	/**
Please login to merge, or discard this patch.
code/model/jobs/DNDeployment.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	}
74 74
 
75 75
 	public function LogLink() {
76
-		return $this->Link() . '/log';
76
+		return $this->Link().'/log';
77 77
 	}
78 78
 
79 79
 	public function canView($member = null) {
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	public function getFullDeployMessages() {
207 207
 		$strategy = $this->getDeploymentStrategy();
208
-		if ($strategy->getActionCode()!=='full') return null;
208
+		if($strategy->getActionCode() !== 'full') return null;
209 209
 
210 210
 		$changes = $strategy->getChangesModificationNeeded();
211 211
 		$messages = [];
212
-		foreach ($changes as $change => $details) {
213
-			if ($change==='Code version') continue;
212
+		foreach($changes as $change => $details) {
213
+			if($change === 'Code version') continue;
214 214
 
215 215
 			$messages[] = [
216 216
 				'Flag' => sprintf(
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 			];
222 222
 		}
223 223
 
224
-		if (empty($messages)) {
224
+		if(empty($messages)) {
225 225
 			$messages[] = [
226 226
 				'Flag' => '',
227 227
 				'Text' => '<i>Environment changes have been made.</i>'
Please login to merge, or discard this patch.
code/model/jobs/DNDataTransfer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	}
113 113
 
114 114
 	public function getTitle() {
115
-		return $this->dbObject('Created')->Nice() . " (Status: {$this->Status})";
115
+		return $this->dbObject('Created')->Nice()." (Status: {$this->Status})";
116 116
 	}
117 117
 
118 118
 	public function Link() {
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
 		$envName = $this->Environment()->getFullName();
234 234
 		if($this->Direction == 'get') {
235 235
 			if($this->Origin == 'ManualUpload') {
236
-				$description = 'Manual upload of ' . $this->getModeNice() . ' to ' . $envName;
236
+				$description = 'Manual upload of '.$this->getModeNice().' to '.$envName;
237 237
 			} elseif($this->IsBackupDataTransfer()) {
238
-				$description = 'Automated backup of ' . $this->getModeNice() . ' from ' . $envName;
238
+				$description = 'Automated backup of '.$this->getModeNice().' from '.$envName;
239 239
 			} else {
240
-				$description = 'Backup of ' . $this->getModeNice() . ' to ' . $envName;
240
+				$description = 'Backup of '.$this->getModeNice().' to '.$envName;
241 241
 			}
242 242
 		} else {
243
-			$description = 'Restore ' . $this->getModeNice() . ' to ' . $envName;
243
+			$description = 'Restore '.$this->getModeNice().' to '.$envName;
244 244
 		}
245 245
 
246 246
 		return $description;
Please login to merge, or discard this patch.
code/model/jobs/DNCreateEnvironment.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @return string
69 69
 	 */
70 70
 	public function LogLink() {
71
-		return $this->Link() . '/log';
71
+		return $this->Link().'/log';
72 72
 	}
73 73
 
74 74
 	/**
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 			if($env instanceof EnvironmentCreateBackend) {
191 191
 				return $env;
192 192
 			} else {
193
-				throw new Exception("Invalid backend: " . $data['EnvironmentType']);
193
+				throw new Exception("Invalid backend: ".$data['EnvironmentType']);
194 194
 			}
195 195
 		}
196 196
 		return null;
Please login to merge, or discard this patch.
code/control/DeploynautLogFile.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @return string
40 40
 	 */
41 41
 	public function getRawFilePath() {
42
-		return $this->basePath . '/' . $this->logFile;
42
+		return $this->basePath.'/'.$this->logFile;
43 43
 	}
44 44
 
45 45
 	/**
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @return string
48 48
 	 */
49 49
 	public function getSanitisedLogFilePath() {
50
-		return $this->basePath . '/' . strtolower(FileNameFilter::create()->filter($this->logFile));
50
+		return $this->basePath.'/'.strtolower(FileNameFilter::create()->filter($this->logFile));
51 51
 	}
52 52
 
53 53
 	/**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		// Make sure we write into the old path for existing logs. New logs use the sanitised file path instead.
78 78
 		$path = file_exists($this->getRawFilePath()) ? $this->getRawFilePath() : $this->getSanitisedLogFilePath();
79 79
 
80
-		error_log('['.date('Y-m-d H:i:s').'] ' . $message .PHP_EOL, 3, $path);
80
+		error_log('['.date('Y-m-d H:i:s').'] '.$message.PHP_EOL, 3, $path);
81 81
 		@chmod($path, 0666);
82 82
 	}
83 83
 
Please login to merge, or discard this patch.
code/control/CheckPipelineStatus.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 		printf(
26 26
 			"%s Checking status of %d pipelines... ",
27
-			"[" . date("Y-m-d H:i:s") . "]",
27
+			"[".date("Y-m-d H:i:s")."]",
28 28
 			$runningPipelines->count()
29 29
 		);
30 30
 
@@ -32,6 +32,6 @@  discard block
 block discarded – undo
32 32
 			$pipeline->checkPipelineStatus();
33 33
 		}
34 34
 
35
-		echo "done!" . PHP_EOL;
35
+		echo "done!".PHP_EOL;
36 36
 	}
37 37
 }
Please login to merge, or discard this patch.