Completed
Push — master ( 334660...5c3956 )
by Stig
05:05
created
code/jobs/FetchJob.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 	public function perform() {
34 34
 		set_time_limit(0);
35 35
 
36
-		if(!empty($this->args['logfile'])) {
36
+		if (!empty($this->args['logfile'])) {
37 37
 			$this->log = new DeploynautLogFile($this->args['logfile']);
38 38
 		}
39 39
 
40 40
 		$this->project = DNProject::get()->byId($this->args['projectID']);
41
-		if(!($this->project && $this->project->exists())) {
41
+		if (!($this->project && $this->project->exists())) {
42 42
 			throw new RuntimeException(sprintf('Project ID %s not found', $this->args['projectID']));
43 43
 		}
44 44
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		// Disallow concurrent git fetches on the same project.
48 48
 		// Only consider fetches started in the last 30 minutes (older jobs probably got stuck)
49 49
 		try {
50
-			if(!empty($this->args['fetchID'])) {
50
+			if (!empty($this->args['fetchID'])) {
51 51
 				$runningFetches = DNGitFetch::get()
52 52
 					->filter(array(
53 53
 						'ProjectID' => $this->project->ID,
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 					))
57 57
 					->exclude('ID', $this->args['fetchID']);
58 58
 
59
-				if($runningFetches->count()) {
59
+				if ($runningFetches->count()) {
60 60
 					$runningFetch = $runningFetches->first();
61 61
 					$message = sprintf(
62 62
 						'Another fetch is in progress (started at %s by %s)',
63 63
 						$runningFetch->dbObject('Created')->Nice(),
64 64
 						$runningFetch->Deployer()->Title
65 65
 					);
66
-					if($this->log) {
66
+					if ($this->log) {
67 67
 						$this->log->write($message);
68 68
 					}
69 69
 					throw new RuntimeException($message);
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
 
73 73
 			// Decide whether we need to just update what we already have
74 74
 			// or initiate a clone if no local repo exists.
75
-			if($this->project->repoExists() && empty($this->args['forceClone'])) {
75
+			if ($this->project->repoExists() && empty($this->args['forceClone'])) {
76 76
 				$this->fetchRepo();
77 77
 			} else {
78 78
 				$this->cloneRepo();
79 79
 			}
80
-		} catch(Exception $e) {
81
-			if($this->log) {
80
+		} catch (Exception $e) {
81
+			if ($this->log) {
82 82
 				$this->log->write($e->getMessage());
83 83
 			}
84 84
 			throw $e;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	}
96 96
 
97 97
 	protected function cloneRepo() {
98
-		if(file_exists($this->project->getLocalCVSPath())) {
98
+		if (file_exists($this->project->getLocalCVSPath())) {
99 99
 			$this->runCommand(sprintf(
100 100
 				'rm -rf %s',
101 101
 				escapeshellarg($this->project->getLocalCVSPath())
@@ -117,17 +117,17 @@  discard block
 block discarded – undo
117 117
 	 * @throws RuntimeException
118 118
 	 */
119 119
 	protected function runCommand($command, $workingDir = null) {
120
-		if(!empty($this->user)) {
120
+		if (!empty($this->user)) {
121 121
 			$command = sprintf('sudo -u %s %s', $this->user, $command);
122 122
 		}
123
-		if($this->log) {
123
+		if ($this->log) {
124 124
 			$this->log->write(sprintf('Running command: %s', $command));
125 125
 		}
126 126
 		$process = new AbortableProcess($command, $workingDir);
127 127
 		$process->setEnv($this->project->getProcessEnv());
128 128
 		$process->setTimeout(1800);
129 129
 		$process->run();
130
-		if(!$process->isSuccessful()) {
130
+		if (!$process->isSuccessful()) {
131 131
 			throw new RuntimeException($process->getErrorOutput());
132 132
 		}
133 133
 	}
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 		global $databaseConfig;
141 141
 		DB::connect($databaseConfig);
142 142
 
143
-		if(!empty($this->args['fetchID'])) {
143
+		if (!empty($this->args['fetchID'])) {
144 144
 			$fetch = DNGitFetch::get()->byID($this->args['fetchID']);
145
-			if($fetch && $fetch->exists()) {
145
+			if ($fetch && $fetch->exists()) {
146 146
 				$fetch->Status = $status;
147 147
 				$fetch->write();
148 148
 			}
Please login to merge, or discard this patch.
code/form/TabbedSelectionGroup.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 		$items = CompositeField::FieldList()->toArray();
10 10
 		$fields = new ArrayList();
11 11
 
12
-		foreach($items as $item) {
12
+		foreach ($items as $item) {
13 13
 			$extra = array(
14 14
 				'Selected' => $this->value == $item->getValue(),
15 15
 			);
Please login to merge, or discard this patch.
code/form/DataArchiveFileField.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 	 * @return bool|DataArchiveFileField
16 16
 	 */
17 17
 	public function saveInto(DataObjectInterface $record) {
18
-		if(!isset($_FILES[$this->name])) {
18
+		if (!isset($_FILES[$this->name])) {
19 19
 			return false;
20 20
 		}
21 21
 
22
-		if(!($record instanceof DNDataArchive)) {
22
+		if (!($record instanceof DNDataArchive)) {
23 23
 			throw new LogicException('Saving into wrong type, expected DNDataArchive');
24 24
 		}
25 25
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 		/** @var DNDataTransfer $dataTransfer */
29 29
 		$dataTransfer = $dataArchive->DataTransfers()->First();
30
-		if(!$dataTransfer) {
30
+		if (!$dataTransfer) {
31 31
 			throw new LogicException('No transfer found');
32 32
 		}
33 33
 
@@ -36,16 +36,16 @@  discard block
 block discarded – undo
36 36
 		// Hack: loadIntoFile assumes paths relative to assets,
37 37
 		//  otherwise it creates the whole structure *within* that folder
38 38
 		$absolutePath = $dataArchive->generateFilepath($dataTransfer);
39
-		$relativePath = preg_replace('#^' . preg_quote(ASSETS_PATH) . '/#', '', $absolutePath);
39
+		$relativePath = preg_replace('#^'.preg_quote(ASSETS_PATH).'/#', '', $absolutePath);
40 40
 		$this->upload->loadIntoFile($_FILES[$this->name], $file, $relativePath);
41
-		if($this->upload->isError()) {
41
+		if ($this->upload->isError()) {
42 42
 			return false;
43 43
 		}
44 44
 
45 45
 		$file = $this->upload->getFile();
46
-		if($this->relationAutoSetting) {
46
+		if ($this->relationAutoSetting) {
47 47
 			// save to record
48
-			$record->{$this->name . 'ID'} = $file->ID;
48
+			$record->{$this->name.'ID'} = $file->ID;
49 49
 		}
50 50
 
51 51
 		return $this;
Please login to merge, or discard this patch.
code/extensions/DeploynautSecurityExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 		// the 'ping' action is called via AJAX from the /admin and will cause
7 7
 		// the admin section to 'grow' over time. We only need the css and js
8 8
 		// for login, reset, logout and so on.
9
-		if(!$this->owner->getRequest()->isAjax()) {
9
+		if (!$this->owner->getRequest()->isAjax()) {
10 10
 			DNRoot::include_requirements();
11 11
 		}
12 12
 	}
Please login to merge, or discard this patch.
code/extensions/DeploynautFileExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 		$file = $this->owner;
12 12
 		$archive = DNDataArchive::get()->filter('ArchiveFileID', $file->ID)->First();
13 13
 
14
-		if($archive) {
14
+		if ($archive) {
15 15
 			return $archive->canDownload($member);
16 16
 		}
17 17
 
Please login to merge, or discard this patch.
code/queuereport/ResqueReport.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
 	protected function getQueues() {
54 54
 		$queues = Resque::queues();
55 55
 		$queueList = new ArrayList();
56
-		foreach($queues as $idx => $queue) {
56
+		foreach ($queues as $idx => $queue) {
57 57
 			$queueList->push(new ResqueQueue(array(
58 58
 				'ID' => ($idx + 1),
59 59
 				'Name' => $queue,
Please login to merge, or discard this patch.
code/queuereport/ResqueJob.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
 	 * @return mixed
61 61
 	 */
62 62
 	public function __get($property) {
63
-		if(isset($this->record[$property])) {
63
+		if (isset($this->record[$property])) {
64 64
 			return $this->record[$property];
65 65
 		}
66 66
 		return null;
Please login to merge, or discard this patch.
code/queuereport/ResqueQueue.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -49,20 +49,20 @@  discard block
 block discarded – undo
49 49
 	protected function getJobs() {
50 50
 		$jobs = new ArrayList();
51 51
 
52
-		$resqueJobs = Resque::redis()->lrange('queue:' . $this->Name, 0, -1);
53
-		if(!$resqueJobs) {
52
+		$resqueJobs = Resque::redis()->lrange('queue:'.$this->Name, 0, -1);
53
+		if (!$resqueJobs) {
54 54
 			$jobs->push(new ResqueJob(array(
55 55
 				'Name' => 'null',
56 56
 				'Value' => 'null',
57 57
 			)));
58 58
 			return $jobs;
59 59
 		}
60
-		foreach($resqueJobs as $idx => $job) {
60
+		foreach ($resqueJobs as $idx => $job) {
61 61
 			$stdClass = json_decode($job);
62
-			if($stdClass->class === 'CapistranoDeploy' || $stdClass->class === 'DeployJob') {
62
+			if ($stdClass->class === 'CapistranoDeploy' || $stdClass->class === 'DeployJob') {
63 63
 				$value = $stdClass->args[0]->projectName
64
-					. ':' . $stdClass->args[0]->environment
65
-					. ' - ' . $stdClass->args[0]->sha;
64
+					. ':'.$stdClass->args[0]->environment
65
+					. ' - '.$stdClass->args[0]->sha;
66 66
 				$jobs->push(new ResqueJob(array(
67 67
 					'Name' => $stdClass->class,
68 68
 					'Value' => $value,
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @return mixed
112 112
 	 */
113 113
 	public function __get($property) {
114
-		if(isset($this->record[$property])) {
114
+		if (isset($this->record[$property])) {
115 115
 			return $this->record[$property];
116 116
 		}
117 117
 		return null;
Please login to merge, or discard this patch.
code/AbortableProcess.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 class AbortableProcess extends \Symfony\Component\Process\Process {
16 16
 	public function run($callback = null) {
17 17
 		$this->start($callback);
18
-		while($this->isRunning()) {
18
+		while ($this->isRunning()) {
19 19
 			$this->checkTimeout();
20 20
 			sleep(1);
21 21
 		}
Please login to merge, or discard this patch.