Test Setup Failed
Push — 17.1 ( 380500...6edd18 )
by Ralf
08:56
created
install-cli.php 1 patch
Braces   +60 added lines, -15 removed lines patch added patch discarded remove patch
@@ -37,10 +37,13 @@  discard block
 block discarded – undo
37 37
 
38 38
 chdir(__DIR__);	// to enable relative pathes to work
39 39
 
40
-if (php_sapi_name() !== 'cli')	// security precaution: forbit calling setup-cli as web-page
40
+if (php_sapi_name() !== 'cli')
41
+{
42
+	// security precaution: forbit calling setup-cli as web-page
41 43
 {
42 44
 	die('<h1>install-cli.php must NOT be called as web-page --> exiting !!!</h1>');
43 45
 }
46
+}
44 47
 error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
45 48
 
46 49
 // parse arguments
@@ -76,7 +79,10 @@  discard block
 block discarded – undo
76 79
 	}
77 80
 }
78 81
 
79
-if (count($argv) > 1) usage("Too many arguments!");
82
+if (count($argv) > 1)
83
+{
84
+	usage("Too many arguments!");
85
+}
80 86
 
81 87
 function usage($err=null)
82 88
 {
@@ -131,9 +137,15 @@  discard block
 block discarded – undo
131 137
 	}
132 138
 }
133 139
 
134
-if ($verbose) echo "Using following binaries: ".json_encode ($bins, JSON_UNESCAPED_SLASHES)."\n";
140
+if ($verbose)
141
+{
142
+	echo "Using following binaries: ".json_encode ($bins, JSON_UNESCAPED_SLASHES)."\n";
143
+}
135 144
 
136
-if (!extension_loaded('curl')) die("Required PHP extesion 'curl' missing! You need to install php-curl package.\n\n");
145
+if (!extension_loaded('curl'))
146
+{
147
+	die("Required PHP extesion 'curl' missing! You need to install php-curl package.\n\n");
148
+}
137 149
 
138 150
 // check if we are on a git clone
139 151
 $output = array();
@@ -165,7 +177,10 @@  discard block
 block discarded – undo
165 177
 {
166 178
 	$channel = isset($matches[1]) ? 'release' : 'bugfix';
167 179
 }
168
-if ($verbose) echo "Currently using branch: $branch --> $channel channel\n";
180
+if ($verbose)
181
+{
182
+	echo "Currently using branch: $branch --> $channel channel\n";
183
+}
169 184
 
170 185
 if ($argv)
171 186
 {
@@ -216,24 +231,36 @@  discard block
 block discarded – undo
216 231
 			$cmd .= "; $git pull --rebase";
217 232
 		}
218 233
 		$cmd .= "; test -z \"$($git stash list)\" || $git stash pop";
219
-		if ($verbose) echo "$cmd\n";
234
+		if ($verbose)
235
+		{
236
+			echo "$cmd\n";
237
+		}
220 238
 		system($cmd);
221 239
 	}
222 240
 }
223 241
 
224 242
 // update composer managed dependencies
225 243
 $cmd = $composer.' install';
226
-if ($verbose) echo "$cmd\n";
244
+if ($verbose)
245
+{
246
+	echo "$cmd\n";
247
+}
227 248
 system($cmd);
228 249
 
229 250
 // update npm dependencies and run grunt to minify javascript and css
230 251
 if ($npm && $grunt)
231 252
 {
232 253
 	$cmd = $npm.' install';
233
-	if ($verbose) echo "$cmd\n";
254
+	if ($verbose)
255
+	{
256
+		echo "$cmd\n";
257
+	}
234 258
 	system($cmd);
235 259
 
236
-	if ($verbose) echo "$grunt\n";
260
+	if ($verbose)
261
+	{
262
+		echo "$grunt\n";
263
+	}
237 264
 	system($grunt);
238 265
 }
239 266
 
@@ -283,25 +310,40 @@  discard block
 block discarded – undo
283 310
 	{
284 311
 		case 'POST':
285 312
 			curl_setopt($c, CURLOPT_POST, true);
286
-			if (is_array($data)) $data = json_encode($data, JSON_FORCE_OBJECT);
313
+			if (is_array($data))
314
+			{
315
+				$data = json_encode($data, JSON_FORCE_OBJECT);
316
+			}
287 317
 			curl_setopt($c, CURLOPT_POSTFIELDS, $data);
288 318
 			break;
289 319
 		case 'GET':
290
-			if(count($data)) $url .= '?' . http_build_query($data);
320
+			if(count($data))
321
+			{
322
+				$url .= '?' . http_build_query($data);
323
+			}
291 324
 			break;
292 325
 		case 'FILE':
293 326
 			curl_setopt($c, CURLOPT_HTTPHEADER, array("Content-type: $content_type"));
294 327
 			curl_setopt($c, CURLOPT_POST, true);
295 328
 			curl_setopt($c, CURLOPT_POSTFIELDS, file_get_contents($upload));
296
-			if(count($data)) $url .= '?' . http_build_query($data);
329
+			if(count($data))
330
+			{
331
+				$url .= '?' . http_build_query($data);
332
+			}
297 333
 			break;
298 334
 		default:
299 335
 			throw new Exception(__FUNCTION__.": Unknown/unimplemented method=$method!");
300 336
 	}
301 337
 	curl_setopt($c, CURLOPT_URL, $url);
302 338
 
303
-	if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data;
304
-	if ($verbose) echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n";
339
+	if (is_string($data))
340
+	{
341
+		$short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data;
342
+	}
343
+	if ($verbose)
344
+	{
345
+		echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n";
346
+	}
305 347
 
306 348
 	if (($response = curl_exec($c)) === false)
307 349
 	{
@@ -312,7 +354,10 @@  discard block
 block discarded – undo
312 354
 		throw new Exception("$method request to $url failed ".(isset($short_data)&&$method!='GET'?$short_data:''));
313 355
 	}
314 356
 
315
-	if ($verbose) echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n";
357
+	if ($verbose)
358
+	{
359
+		echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n";
360
+	}
316 361
 
317 362
 	curl_close($c);
318 363
 
Please login to merge, or discard this patch.