Completed
Push — master ( 8c9164...b6bbdb )
by Stig
12:08 queued 06:40
created
code/model/DNDataArchive.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	}
122 122
 
123 123
 	public function onBeforeWrite() {
124
-		if(!$this->AuthorID) {
124
+		if (!$this->AuthorID) {
125 125
 			$this->AuthorID = Member::currentUserID();
126 126
 		}
127 127
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @return string The human-readable size of this archive file
180 180
 	 */
181 181
 	public function FileSize() {
182
-		if($this->ArchiveFile()->exists()) {
182
+		if ($this->ArchiveFile()->exists()) {
183 183
 			return $this->ArchiveFile()->getSize();
184 184
 		} else {
185 185
 			return "N/A";
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	}
188 188
 
189 189
 	public function getModeNice() {
190
-		if($this->Mode == 'all') {
190
+		if ($this->Mode == 'all') {
191 191
 			return 'database and assets';
192 192
 		} else {
193 193
 			return $this->Mode;
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	public function canRestore($member = null) {
225 225
 		$memberID = $member ? $member->ID : Member::currentUserID();
226
-		if(!$memberID) {
226
+		if (!$memberID) {
227 227
 			return false;
228 228
 		}
229 229
 
230
-		$key = $memberID . '-' . $this->EnvironmentID;
231
-		if(!isset(self::$_cache_can_restore[$key])) {
230
+		$key = $memberID.'-'.$this->EnvironmentID;
231
+		if (!isset(self::$_cache_can_restore[$key])) {
232 232
 			self::$_cache_can_restore[$key] = $this->Environment()->canUploadArchive($member);
233 233
 		}
234 234
 
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	public function canDownload($member = null) {
246 246
 		$memberID = $member ? $member->ID : Member::currentUserID();
247
-		if(!$memberID) {
247
+		if (!$memberID) {
248 248
 			return false;
249 249
 		}
250 250
 
251
-		$key = $memberID . '-' . $this->EnvironmentID;
252
-		if(!isset(self::$_cache_can_download[$key])) {
251
+		$key = $memberID.'-'.$this->EnvironmentID;
252
+		if (!isset(self::$_cache_can_download[$key])) {
253 253
 			self::$_cache_can_download[$key] = $this->Environment()->canDownloadArchive($member);
254 254
 		}
255 255
 		return self::$_cache_can_download[$key];
@@ -274,27 +274,27 @@  discard block
 block discarded – undo
274 274
 	 * @return boolean true if $member can upload archives linked to this environment, false if they can't.
275 275
 	 */
276 276
 	public function canMoveTo($targetEnv, $member = null) {
277
-		if($this->Environment()->Project()->ID != $targetEnv->Project()->ID) {
277
+		if ($this->Environment()->Project()->ID != $targetEnv->Project()->ID) {
278 278
 			// We don't permit moving snapshots between projects at this stage.
279 279
 			return false;
280 280
 		}
281 281
 
282
-		if(!$member) {
282
+		if (!$member) {
283 283
 			$member = Member::currentUser();
284 284
 		}
285 285
 
286 286
 		// Must be logged in to check permissions
287
-		if(!$member) {
287
+		if (!$member) {
288 288
 			return false;
289 289
 		}
290 290
 
291 291
 		// Admin can always move.
292
-		if(Permission::checkMember($member, 'ADMIN')) {
292
+		if (Permission::checkMember($member, 'ADMIN')) {
293 293
 			return true;
294 294
 		}
295 295
 
296 296
 		// Checks if the user can actually access the archive.
297
-		if(!$this->canDownload($member)) {
297
+		if (!$this->canDownload($member)) {
298 298
 			return false;
299 299
 		}
300 300
 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 	 * @return bool
404 404
 	 */
405 405
 	public function extractArchive($workingDir = null) {
406
-		if(!is_dir($workingDir)) {
406
+		if (!is_dir($workingDir)) {
407 407
 			mkdir($workingDir, 0700, true);
408 408
 		}
409 409
 
@@ -422,28 +422,28 @@  discard block
 block discarded – undo
422 422
 		));
423 423
 		$process->setTimeout(3600);
424 424
 		$process->run();
425
-		if(!$process->isSuccessful()) {
425
+		if (!$process->isSuccessful()) {
426 426
 			$cleanupFn();
427 427
 			throw new RuntimeException(sprintf('Could not extract the sspak file: %s', $process->getErrorOutput()));
428 428
 		}
429 429
 
430 430
 		// Extract database.sql.gz to <workingdir>/database.sql
431
-		if(file_exists($workingDir . DIRECTORY_SEPARATOR . 'database.sql.gz')) {
431
+		if (file_exists($workingDir.DIRECTORY_SEPARATOR.'database.sql.gz')) {
432 432
 			$process = new AbortableProcess('gunzip database.sql.gz', $workingDir);
433 433
 			$process->setTimeout(3600);
434 434
 			$process->run();
435
-			if(!$process->isSuccessful()) {
435
+			if (!$process->isSuccessful()) {
436 436
 				$cleanupFn();
437 437
 				throw new RuntimeException(sprintf('Could not extract the db archive: %s', $process->getErrorOutput()));
438 438
 			}
439 439
 		}
440 440
 
441 441
 		// Extract assets.tar.gz to <workingdir>/assets/
442
-		if(file_exists($workingDir . DIRECTORY_SEPARATOR . 'assets.tar.gz')) {
442
+		if (file_exists($workingDir.DIRECTORY_SEPARATOR.'assets.tar.gz')) {
443 443
 			$process = new AbortableProcess('tar xzf assets.tar.gz', $workingDir);
444 444
 			$process->setTimeout(3600);
445 445
 			$process->run();
446
-			if(!$process->isSuccessful()) {
446
+			if (!$process->isSuccessful()) {
447 447
 				$cleanupFn();
448 448
 				throw new RuntimeException(sprintf('Could not extract the assets archive: %s', $process->getErrorOutput()));
449 449
 			}
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 
468 468
 		$file = $this->ArchiveFile()->FullPath;
469 469
 
470
-		if(!is_readable($file)) {
470
+		if (!is_readable($file)) {
471 471
 			$result->error(sprintf('SSPak file "%s" cannot be read.', $file));
472 472
 			return $result;
473 473
 		}
@@ -475,19 +475,19 @@  discard block
 block discarded – undo
475 475
 		$process = new AbortableProcess(sprintf('tar -tf %s', escapeshellarg($file)));
476 476
 		$process->setTimeout(120);
477 477
 		$process->run();
478
-		if(!$process->isSuccessful()) {
478
+		if (!$process->isSuccessful()) {
479 479
 			throw new RuntimeException(sprintf('Could not list files in archive: %s', $process->getErrorOutput()));
480 480
 		}
481 481
 
482 482
 		$output = explode(PHP_EOL, $process->getOutput());
483 483
 		$files = array_filter($output);
484 484
 
485
-		if(in_array($mode, array('all', 'db')) && !in_array('database.sql.gz', $files)) {
485
+		if (in_array($mode, array('all', 'db')) && !in_array('database.sql.gz', $files)) {
486 486
 			$result->error('The snapshot is missing the database.');
487 487
 			return $result;
488 488
 		}
489 489
 
490
-		if(in_array($mode, array('all', 'assets')) && !in_array('assets.tar.gz', $files)) {
490
+		if (in_array($mode, array('all', 'assets')) && !in_array('assets.tar.gz', $files)) {
491 491
 			$result->error('The snapshot is missing assets.');
492 492
 			return $result;
493 493
 		}
@@ -517,11 +517,11 @@  discard block
 block discarded – undo
517 517
 			sprintf('find %s -type f -exec chmod 644 {} +', escapeshellarg($workingDir))
518 518
 		);
519 519
 
520
-		foreach($fixCmds as $cmd) {
520
+		foreach ($fixCmds as $cmd) {
521 521
 			$process = new AbortableProcess($cmd);
522 522
 			$process->setTimeout(3600);
523 523
 			$process->run();
524
-			if(!$process->isSuccessful()) {
524
+			if (!$process->isSuccessful()) {
525 525
 				throw new RuntimeException($process->getErrorOutput());
526 526
 			}
527 527
 		}
@@ -540,18 +540,18 @@  discard block
 block discarded – undo
540 540
 	 */
541 541
 	public function setArchiveFromFiles($workingDir) {
542 542
 		$commands = array();
543
-		if($this->Mode == 'db') {
544
-			if (file_exists($workingDir . '/database.sql')) {
543
+		if ($this->Mode == 'db') {
544
+			if (file_exists($workingDir.'/database.sql')) {
545 545
 				$commands[] = 'gzip database.sql';
546 546
 			}
547 547
 			$commands[] = sprintf('tar -cf %s database.sql.gz', $this->ArchiveFile()->FullPath);
548 548
 			$commands[] = 'rm -f database.sql.gz';
549
-		} elseif($this->Mode == 'assets') {
549
+		} elseif ($this->Mode == 'assets') {
550 550
 			$commands[] = 'GZIP=-1 tar --dereference -czf assets.tar.gz assets';
551 551
 			$commands[] = sprintf('tar -cf %s assets.tar.gz', $this->ArchiveFile()->FullPath);
552 552
 			$commands[] = 'rm -f assets.tar.gz';
553 553
 		} else {
554
-			if (file_exists($workingDir . '/database.sql')) {
554
+			if (file_exists($workingDir.'/database.sql')) {
555 555
 				$commands[] = 'gzip database.sql';
556 556
 			}
557 557
 			$commands[] = 'GZIP=-1 tar --dereference -czf assets.tar.gz assets';
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 		$process = new AbortableProcess(implode(' && ', $commands), $workingDir);
563 563
 		$process->setTimeout(3600);
564 564
 		$process->run();
565
-		if(!$process->isSuccessful()) {
565
+		if (!$process->isSuccessful()) {
566 566
 			throw new RuntimeException($process->getErrorOutput());
567 567
 		}
568 568
 
Please login to merge, or discard this patch.
code/tasks/CleanupOrphanedRecordsTask.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 
5 5
 	public function run($request) {
6 6
 		$log = function($message) {
7
-			$message = sprintf('[%s] ', date('Y-m-d H:i:s')) . $message;
8
-			echo $message . PHP_EOL;
7
+			$message = sprintf('[%s] ', date('Y-m-d H:i:s')).$message;
8
+			echo $message.PHP_EOL;
9 9
 		};
10 10
 
11 11
 		if (!Director::is_cli()) {
Please login to merge, or discard this patch.
code/model/options/NoRollbackDeployOption.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
 	}
13 13
 
14 14
 	public function __get($name) {
15
-		if (method_exists($this, 'get' . $name)) {
16
-			return $this->{'get' . $name}();
15
+		if (method_exists($this, 'get'.$name)) {
16
+			return $this->{'get'.$name}();
17 17
 		}
18 18
 		return $this->$name;
19 19
 	}
Please login to merge, or discard this patch.
code/model/options/PredeployBackupOption.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
 	}
13 13
 
14 14
 	public function __get($name) {
15
-		if (method_exists($this, 'get' . $name)) {
16
-			return $this->{'get' . $name}();
15
+		if (method_exists($this, 'get'.$name)) {
16
+			return $this->{'get'.$name}();
17 17
 		}
18 18
 		return $this->$name;
19 19
 	}
Please login to merge, or discard this patch.
code/control/DeployForm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 				substr($sha, 0, 8),
95 95
 				$branch->LastUpdated()->TimeDiff()
96 96
 			);
97
-			$branches[$sha . '-' . $name] = $branchValue;
97
+			$branches[$sha.'-'.$name] = $branchValue;
98 98
 		}
99 99
 
100 100
 		// Tags
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 				substr($sha, 0, 8),
108 108
 				$branch->LastUpdated()->TimeDiff()
109 109
 			);
110
-			$tags[$sha . '-' . $name] = $tagValue;
110
+			$tags[$sha.'-'.$name] = $tagValue;
111 111
 		}
112 112
 		$tags = array_reverse($tags);
113 113
 
Please login to merge, or discard this patch.