Completed
Push — master ( b3aafe...e1584b )
by Mateusz
03:05
created
code/tasks/SyncProjectsAndEnvironments.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 		if($dryRun) {
21 21
 			echo "Running in dry run mode, no changes commited, ";
22
-			echo "the output shows a prediction on what will happen." . PHP_EOL;
23
-			echo "To skip dryrun, run the task like this:" . PHP_EOL;
24
-			echo "./framework/sake dev/tasks/SyncProjectsAndEnvironments dryrun=0" . PHP_EOL . PHP_EOL;
22
+			echo "the output shows a prediction on what will happen.".PHP_EOL;
23
+			echo "To skip dryrun, run the task like this:".PHP_EOL;
24
+			echo "./framework/sake dev/tasks/SyncProjectsAndEnvironments dryrun=0".PHP_EOL.PHP_EOL;
25 25
 			sleep(3);
26 26
 		}
27 27
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		}
68 68
 
69 69
 		foreach($removeList as $remove) {
70
-			$this->message('Removing "' . basename($remove->Name) . '" from db');
70
+			$this->message('Removing "'.basename($remove->Name).'" from db');
71 71
 			if(!$dryRun) {
72 72
 				$removeList->remove($remove);
73 73
 			}
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 		}
89 89
 
90 90
 		foreach($removeList as $remove) {
91
-			$this->message($remove->Name . ' ' . $remove->Path);
91
+			$this->message($remove->Name.' '.$remove->Path);
92 92
 			if(!$dryrun) {
93 93
 				$removeList->remove($remove);
94 94
 			}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 				continue;
121 121
 			}
122 122
 
123
-			$this->message('Adding "' . basename($path) . '" to db');
123
+			$this->message('Adding "'.basename($path).'" to db');
124 124
 			if(!$dryRun) {
125 125
 				$environment = DNEnvironment::create_from_path($path);
126 126
 				$environment->ProjectID = $project->ID;
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	protected function message($text) {
153 153
 		if(PHP_SAPI !== 'cli') {
154
-			$text = '<p>' . $text . '</p>' . PHP_EOL;
154
+			$text = '<p>'.$text.'</p>'.PHP_EOL;
155 155
 		}
156
-		echo ' - ' . $text . PHP_EOL;
156
+		echo ' - '.$text.PHP_EOL;
157 157
 	}
158 158
 
159 159
 	/**
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	protected function echoHeader($text) {
163 163
 		if(PHP_SAPI !== 'cli') {
164
-			echo '<h2>' . $text . '</h2>' . PHP_EOL;
164
+			echo '<h2>'.$text.'</h2>'.PHP_EOL;
165 165
 		} else {
166
-			echo '# ' . $text . PHP_EOL;
166
+			echo '# '.$text.PHP_EOL;
167 167
 		}
168 168
 	}
169 169
 }
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' => 'Fetch queued as job ' . $fetch->ResqueToken,
92
+			'message' => 'Fetch queued as job '.$fetch->ResqueToken,
93 93
 			'href' => $location,
94 94
 		);
95 95
 
Please login to merge, or discard this patch.
code/api/nouns/APIEnvironment.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 		$ping->write();
113 113
 		$ping->start();
114 114
 
115
-		$location = Director::absoluteBaseURL() . $this->Link() . '/ping/' . $ping->ID;
115
+		$location = Director::absoluteBaseURL().$this->Link().'/ping/'.$ping->ID;
116 116
 		$output = array(
117
-			'message' => 'Ping queued as job ' . $ping->ResqueToken,
117
+			'message' => 'Ping queued as job '.$ping->ResqueToken,
118 118
 			'href' => $location,
119 119
 		);
120 120
 
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 		));
165 165
 		$deploy = $strategy->createDeployment();
166 166
 		$deploy->start();
167
-		$location = Director::absoluteBaseURL() . $this->Link() . '/deploy/' . $deploy->ID;
167
+		$location = Director::absoluteBaseURL().$this->Link().'/deploy/'.$deploy->ID;
168 168
 		$output = array(
169
-			'message' => 'Deploy queued as job ' . $deploy->ResqueToken,
169
+			'message' => 'Deploy queued as job '.$deploy->ResqueToken,
170 170
 			'href' => $location,
171 171
 		);
172 172
 		$response = $this->getAPIResponse($output);
Please login to merge, or discard this patch.
code/api/DeploynautAPI.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	protected function project404Response() {
107 107
 		$projectName = Convert::raw2xml($this->getRequest()->latestParam('Project'));
108
-		return new SS_HTTPResponse('Project "' . $projectName . '" not found.', 404);
108
+		return new SS_HTTPResponse('Project "'.$projectName.'" not found.', 404);
109 109
 	}
110 110
 
111 111
 	/**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	protected function environment404Response() {
115 115
 		$envName = Convert::raw2xml($this->getRequest()->latestParam('Environment'));
116
-		return new SS_HTTPResponse('Environment "' . $envName . '" not found.', 404);
116
+		return new SS_HTTPResponse('Environment "'.$envName.'" not found.', 404);
117 117
 	}
118 118
 
119 119
 	/**
Please login to merge, or discard this patch.
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/CreateEnvJob.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 *
20 20
 	 */
21 21
 	public function perform() {
22
-		echo "[-] CreateEnvJob starting" . PHP_EOL;
22
+		echo "[-] CreateEnvJob starting".PHP_EOL;
23 23
 		// This is a bit icky, but there is no easy way of capturing a failed deploy by using the PHP Resque
24 24
 		try {
25 25
 			$envCreate = DNCreateEnvironment::get()->byId($this->args['createID']);
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 			$envCreate->createEnvironment();
32 32
 
33 33
 		} catch(Exception $e) {
34
-			echo "[-] CreateEnvJob failed" . PHP_EOL;
34
+			echo "[-] CreateEnvJob failed".PHP_EOL;
35 35
 			throw $e;
36 36
 		}
37 37
 		$this->updateStatus('Finished');
38
-		echo "[-] CreateEnvJob finished" . PHP_EOL;
38
+		echo "[-] CreateEnvJob finished".PHP_EOL;
39 39
 	}
40 40
 
41 41
 	/**
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/model/jobs/DNDeployment.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -205,12 +205,16 @@
 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') {
209
+			return null;
210
+		}
209 211
 
210 212
 		$changes = $strategy->getChangesModificationNeeded();
211 213
 		$messages = [];
212 214
 		foreach ($changes as $change => $details) {
213
-			if ($change==='Code version') continue;
215
+			if ($change==='Code version') {
216
+				continue;
217
+			}
214 218
 
215 219
 			$messages[] = [
216 220
 				'Flag' => sprintf(
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 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>'
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
 			// if there is a compare URL, and a description or a change (something actually changed)
272 272
 			// then show the URL. Otherwise don't show anything, as there is no comparison to be made.
273
-			if ($changed || $description) {
273
+			if($changed || $description) {
274 274
 				$compareUrl = isset($change['compareUrl']) ? $change['compareUrl'] : '';
275 275
 			}
276 276
 
Please login to merge, or discard this patch.
code/model/DNData.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function setEnvironmentDir($environmentDir) {
91 91
 		if($environmentDir[0] != "/") {
92
-			$environmentDir = BASE_PATH . '/' . $environmentDir;
92
+			$environmentDir = BASE_PATH.'/'.$environmentDir;
93 93
 		}
94 94
 		$this->environmentDir = realpath($environmentDir) ?: $environmentDir;
95 95
 	}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function setKeyDir($keyDir) {
112 112
 		if($keyDir[0] != "/") {
113
-			$keyDir = BASE_PATH . '/' . $keyDir;
113
+			$keyDir = BASE_PATH.'/'.$keyDir;
114 114
 		}
115 115
 		$this->keyDir = realpath($keyDir) ?: $keyDir;
116 116
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function setSignalDir($signalDir) {
129 129
 		if($signalDir[0] != "/") {
130
-			$signalDir = BASE_PATH . '/' . $signalDir;
130
+			$signalDir = BASE_PATH.'/'.$signalDir;
131 131
 		}
132 132
 		$this->signalDir = realpath($signalDir) ?: $signalDir;
133 133
 	}
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	public function setDataTransferDir($transferDir) {
171 171
 		if($transferDir[0] != "/") {
172
-			$transferDir = BASE_PATH . '/' . $transferDir;
172
+			$transferDir = BASE_PATH.'/'.$transferDir;
173 173
 		}
174 174
 		if(strpos($transferDir, ASSETS_PATH) === false) {
175 175
 			throw new LogicException(sprintf(
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
 	public function getProjectPaths() {
200 200
 		$paths = array();
201 201
 		if(!file_exists($this->getEnvironmentDir())) {
202
-			$eMessage = 'The environment directory ' . $this->getEnvironmentDir() . ' doesn\'t exist. Create it '
202
+			$eMessage = 'The environment directory '.$this->getEnvironmentDir().' doesn\'t exist. Create it '
203 203
 			. 'first and add some projects to it.';
204 204
 			throw new Exception($eMessage);
205 205
 		}
206 206
 		foreach(scandir($this->getEnvironmentDir()) as $project) {
207 207
 			// Exlcude dot-prefixed directories (.git was getting in the way)
208 208
 			if(preg_match('/^[^\.]/', $project)) {
209
-				$path = $this->getEnvironmentDir() . '/' . $project;
209
+				$path = $this->getEnvironmentDir().'/'.$project;
210 210
 				if(is_dir($path) && $project != '.' && $project != '..') {
211 211
 					$paths[] = $project;
212 212
 				}
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 	 * Returns an array of paths
222 222
 	 */
223 223
 	public function getEnvironmentPaths($project) {
224
-		$baseDir = $this->getEnvironmentDir() . '/' . $project;
224
+		$baseDir = $this->getEnvironmentDir().'/'.$project;
225 225
 
226 226
 		$paths = array();
227 227
 		if(!file_exists($baseDir)) {
228
-			throw new Exception('Environment directory ' . $baseDir . ' doesn\'t exist. Create it first.');
228
+			throw new Exception('Environment directory '.$baseDir.' doesn\'t exist. Create it first.');
229 229
 		}
230 230
 		// Search the directory for config files.
231 231
 		foreach(scandir($baseDir) as $environmentFile) {
Please login to merge, or discard this patch.