@@ -58,20 +58,20 @@ discard block |
||
58 | 58 | |
59 | 59 | try { |
60 | 60 | $repository = new Gitonomy\Git\Repository($this->project->getLocalCVSPath()); |
61 | - } catch(Exception $e) { |
|
61 | + } catch (Exception $e) { |
|
62 | 62 | return $branches; |
63 | 63 | } |
64 | 64 | |
65 | - foreach($repository->getReferences()->getBranches() as $branch) { |
|
65 | + foreach ($repository->getReferences()->getBranches() as $branch) { |
|
66 | 66 | /** @var DNBranch $obj */ |
67 | 67 | $obj = DNBranch::create($branch, $this->project, $this->data); |
68 | - if($branch->getName() == 'master') { |
|
68 | + if ($branch->getName() == 'master') { |
|
69 | 69 | $firstBranch = array($branch->getName() => $obj); |
70 | 70 | } else { |
71 | 71 | $branches[$branch->getName()] = $obj; |
72 | 72 | } |
73 | 73 | } |
74 | - if($firstBranch) { |
|
74 | + if ($firstBranch) { |
|
75 | 75 | $branches = $firstBranch + $branches; |
76 | 76 | } |
77 | 77 | |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | * @return string |
87 | 87 | */ |
88 | 88 | public function byName($name) { |
89 | - if($this->loaded === false) { |
|
89 | + if ($this->loaded === false) { |
|
90 | 90 | $this->getIterator(); |
91 | 91 | } |
92 | 92 | |
93 | - if(isset($this->items[$name])) { |
|
93 | + if (isset($this->items[$name])) { |
|
94 | 94 | return $this->items[$name]; |
95 | 95 | } |
96 | 96 | |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | * @return ArrayIterator |
105 | 105 | */ |
106 | 106 | public function getIterator() { |
107 | - if($this->loaded === false) { |
|
107 | + if ($this->loaded === false) { |
|
108 | 108 | $this->items = $this->getReferences(); |
109 | 109 | $this->loaded = true; |
110 | 110 | } |
111 | - foreach($this->items as $i => $item) { |
|
112 | - if(is_array($item)) { |
|
111 | + foreach ($this->items as $i => $item) { |
|
112 | + if (is_array($item)) { |
|
113 | 113 | $this->items[$i] = new ArrayData($item); |
114 | 114 | } |
115 | 115 | } |
@@ -68,7 +68,7 @@ discard block |
||
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 | /** |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | $status = new Resque_Job_Status($this->ResqueToken); |
111 | 111 | $statusCode = $status->get(); |
112 | 112 | // The Resque job can no longer be found, fallback to the DNDeployment.Status |
113 | - if($statusCode === false) { |
|
113 | + if ($statusCode === false) { |
|
114 | 114 | // Translate from the DNDeployment.Status to the Resque job status for UI purposes |
115 | - switch($this->Status) { |
|
115 | + switch ($this->Status) { |
|
116 | 116 | case 'Finished': |
117 | 117 | return 'Complete'; |
118 | 118 | case 'Started': |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | 'projectName' => $project->Name |
140 | 140 | ); |
141 | 141 | |
142 | - if(!$this->CreatorID) { |
|
142 | + if (!$this->CreatorID) { |
|
143 | 143 | $this->CreatorID = Member::currentUserID(); |
144 | 144 | } |
145 | 145 | |
146 | - if($this->CreatorID) { |
|
146 | + if ($this->CreatorID) { |
|
147 | 147 | $creator = $this->Creator(); |
148 | 148 | $message = sprintf( |
149 | 149 | 'Environment creation for project %s initiated by %s (%s), with IP address %s', |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | public function createEnvironment() { |
173 | 173 | $backend = $this->getBackend(); |
174 | - if($backend) { |
|
174 | + if ($backend) { |
|
175 | 175 | return $backend->createEnvironment($this); |
176 | 176 | } |
177 | 177 | throw new Exception("Unable to find backend."); |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function getBackend() { |
187 | 187 | $data = unserialize($this->Data); |
188 | - if(isset($data['EnvironmentType']) && class_exists($data['EnvironmentType'])) { |
|
188 | + if (isset($data['EnvironmentType']) && class_exists($data['EnvironmentType'])) { |
|
189 | 189 | $env = Injector::inst()->get($data['EnvironmentType']); |
190 | - if($env instanceof EnvironmentCreateBackend) { |
|
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; |
@@ -112,7 +112,7 @@ discard block |
||
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() { |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | 'backupBeforePush' => $this->backupBeforePush |
170 | 170 | ); |
171 | 171 | |
172 | - if(!$this->AuthorID) { |
|
172 | + if (!$this->AuthorID) { |
|
173 | 173 | $this->AuthorID = Member::currentUserID(); |
174 | 174 | } |
175 | 175 | |
176 | - if($this->AuthorID) { |
|
176 | + if ($this->AuthorID) { |
|
177 | 177 | $author = $this->Author(); |
178 | 178 | $message = sprintf( |
179 | 179 | 'Data transfer on %s (%s, %s) initiated by %s (%s), with IP address %s', |
@@ -231,23 +231,23 @@ discard block |
||
231 | 231 | |
232 | 232 | public function getDescription() { |
233 | 233 | $envName = $this->Environment()->getFullName(); |
234 | - if($this->Direction == 'get') { |
|
235 | - if($this->Origin == 'ManualUpload') { |
|
236 | - $description = 'Manual upload of ' . $this->getModeNice() . ' to ' . $envName; |
|
237 | - } elseif($this->IsBackupDataTransfer()) { |
|
238 | - $description = 'Automated backup of ' . $this->getModeNice() . ' from ' . $envName; |
|
234 | + if ($this->Direction == 'get') { |
|
235 | + if ($this->Origin == 'ManualUpload') { |
|
236 | + $description = 'Manual upload of '.$this->getModeNice().' to '.$envName; |
|
237 | + } elseif ($this->IsBackupDataTransfer()) { |
|
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; |
247 | 247 | } |
248 | 248 | |
249 | 249 | public function getModeNice() { |
250 | - if($this->Mode == 'all') { |
|
250 | + if ($this->Mode == 'all') { |
|
251 | 251 | return 'database and assets'; |
252 | 252 | } else { |
253 | 253 | return $this->Mode; |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | $status = new Resque_Job_Status($this->ResqueToken); |
288 | 288 | $statusCode = $status->get(); |
289 | 289 | // The Resque job can no longer be found, fallback to the DNDataTransfer.Status |
290 | - if($statusCode === false) { |
|
290 | + if ($statusCode === false) { |
|
291 | 291 | // Translate from the DNDataTransfer.Status to the Resque job status for UI purposes |
292 | - switch($this->Status) { |
|
292 | + switch ($this->Status) { |
|
293 | 293 | case 'Finished': |
294 | 294 | return 'Complete'; |
295 | 295 | case 'Started': |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | $project = $this->Project(); |
55 | 55 | $log = $this->log(); |
56 | 56 | |
57 | - if(!$this->DeployerID) { |
|
57 | + if (!$this->DeployerID) { |
|
58 | 58 | $this->DeployerID = Member::currentUserID(); |
59 | 59 | } |
60 | 60 | |
61 | - if($this->DeployerID) { |
|
61 | + if ($this->DeployerID) { |
|
62 | 62 | $deployer = $this->Deployer(); |
63 | 63 | $message = sprintf( |
64 | 64 | 'Update repository job for %s initiated by %s (%s)', |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | $status = new Resque_Job_Status($this->ResqueToken); |
132 | 132 | $statusCode = $status->get(); |
133 | 133 | // The Resque job can no longer be found, fallback to the DNDeployment.Status |
134 | - if($statusCode === false) { |
|
134 | + if ($statusCode === false) { |
|
135 | 135 | // Translate from the DNDeployment.Status to the Resque job status for UI purposes |
136 | - switch($this->Status) { |
|
136 | + switch ($this->Status) { |
|
137 | 137 | case 'Finished': |
138 | 138 | return 'Complete'; |
139 | 139 | case 'Started': |
@@ -37,7 +37,7 @@ discard block |
||
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 | /** |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | 'pingID' => $this->ID |
108 | 108 | ); |
109 | 109 | |
110 | - if(!$this->DeployerID) { |
|
110 | + if (!$this->DeployerID) { |
|
111 | 111 | $this->DeployerID = Member::currentUserID(); |
112 | 112 | } |
113 | 113 | |
114 | - if($this->DeployerID) { |
|
114 | + if ($this->DeployerID) { |
|
115 | 115 | $deployer = $this->Deployer(); |
116 | 116 | $message = sprintf( |
117 | 117 | 'Ping to %s initiated by %s (%s)', |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | parent::__construct(); |
60 | 60 | |
61 | 61 | // Better to use injector to set these |
62 | - if(func_num_args() == 0) { |
|
62 | + if (func_num_args() == 0) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | Deprecation::notice( |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | * @param string $environmentDir |
89 | 89 | */ |
90 | 90 | public function setEnvironmentDir($environmentDir) { |
91 | - if($environmentDir[0] != "/") { |
|
92 | - $environmentDir = BASE_PATH . '/' . $environmentDir; |
|
91 | + if ($environmentDir[0] != "/") { |
|
92 | + $environmentDir = BASE_PATH.'/'.$environmentDir; |
|
93 | 93 | } |
94 | 94 | $this->environmentDir = realpath($environmentDir) ?: $environmentDir; |
95 | 95 | } |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @param string $keyDir |
110 | 110 | */ |
111 | 111 | public function setKeyDir($keyDir) { |
112 | - if($keyDir[0] != "/") { |
|
113 | - $keyDir = BASE_PATH . '/' . $keyDir; |
|
112 | + if ($keyDir[0] != "/") { |
|
113 | + $keyDir = BASE_PATH.'/'.$keyDir; |
|
114 | 114 | } |
115 | 115 | $this->keyDir = realpath($keyDir) ?: $keyDir; |
116 | 116 | } |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * @param string $signalDir |
127 | 127 | */ |
128 | 128 | public function setSignalDir($signalDir) { |
129 | - if($signalDir[0] != "/") { |
|
130 | - $signalDir = BASE_PATH . '/' . $signalDir; |
|
129 | + if ($signalDir[0] != "/") { |
|
130 | + $signalDir = BASE_PATH.'/'.$signalDir; |
|
131 | 131 | } |
132 | 132 | $this->signalDir = realpath($signalDir) ?: $signalDir; |
133 | 133 | } |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | * @param string $transferDir |
169 | 169 | */ |
170 | 170 | public function setDataTransferDir($transferDir) { |
171 | - if($transferDir[0] != "/") { |
|
172 | - $transferDir = BASE_PATH . '/' . $transferDir; |
|
171 | + if ($transferDir[0] != "/") { |
|
172 | + $transferDir = BASE_PATH.'/'.$transferDir; |
|
173 | 173 | } |
174 | - if(strpos($transferDir, ASSETS_PATH) === false) { |
|
174 | + if (strpos($transferDir, ASSETS_PATH) === false) { |
|
175 | 175 | throw new LogicException(sprintf( |
176 | 176 | 'DNData::dataTransferDir needs to be located within <webroot>assets/ (location: %s)', |
177 | 177 | $transferDir |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function getProjectPaths() { |
200 | 200 | $paths = array(); |
201 | - if(!file_exists($this->getEnvironmentDir())) { |
|
202 | - $eMessage = 'The environment directory ' . $this->getEnvironmentDir() . ' doesn\'t exist. Create it ' |
|
201 | + if (!file_exists($this->getEnvironmentDir())) { |
|
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 | - foreach(scandir($this->getEnvironmentDir()) as $project) { |
|
206 | + foreach (scandir($this->getEnvironmentDir()) as $project) { |
|
207 | 207 | // Exlcude dot-prefixed directories (.git was getting in the way) |
208 | - if(preg_match('/^[^\.]/', $project)) { |
|
209 | - $path = $this->getEnvironmentDir() . '/' . $project; |
|
210 | - if(is_dir($path) && $project != '.' && $project != '..') { |
|
208 | + if (preg_match('/^[^\.]/', $project)) { |
|
209 | + $path = $this->getEnvironmentDir().'/'.$project; |
|
210 | + if (is_dir($path) && $project != '.' && $project != '..') { |
|
211 | 211 | $paths[] = $project; |
212 | 212 | } |
213 | 213 | } |
@@ -221,15 +221,15 @@ discard block |
||
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 | - if(!file_exists($baseDir)) { |
|
228 | - throw new Exception('Environment directory ' . $baseDir . ' doesn\'t exist. Create it first.'); |
|
227 | + if (!file_exists($baseDir)) { |
|
228 | + throw new Exception('Environment directory '.$baseDir.' doesn\'t exist. Create it first.'); |
|
229 | 229 | } |
230 | 230 | // Search the directory for config files. |
231 | - foreach(scandir($baseDir) as $environmentFile) { |
|
232 | - if(preg_match('/\.rb$/', $environmentFile)) { |
|
231 | + foreach (scandir($baseDir) as $environmentFile) { |
|
232 | + if (preg_match('/\.rb$/', $environmentFile)) { |
|
233 | 233 | // Config found, wrap it into an object. |
234 | 234 | $paths[] = "$baseDir/$environmentFile"; |
235 | 235 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @return string |
75 | 75 | */ |
76 | 76 | public function Name() { |
77 | - if($this->name == null) { |
|
77 | + if ($this->name == null) { |
|
78 | 78 | $this->name = $this->commit->getFixedShortHash(8); |
79 | 79 | } |
80 | 80 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @return string |
95 | 95 | */ |
96 | 96 | public function SubjectMessage() { |
97 | - if($this->subjectMessage == null) { |
|
97 | + if ($this->subjectMessage == null) { |
|
98 | 98 | $this->subjectMessage = $this->commit->getSubjectMessage(); |
99 | 99 | } |
100 | 100 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | public function BodyMessage() { |
105 | - if($this->bodyMessage == null) { |
|
105 | + if ($this->bodyMessage == null) { |
|
106 | 106 | $this->bodyMessage = $this->commit->getBodyMessage(); |
107 | 107 | } |
108 | 108 | |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | * @return ArrayList |
114 | 114 | */ |
115 | 115 | public function References() { |
116 | - if($this->references !== null) { |
|
116 | + if ($this->references !== null) { |
|
117 | 117 | return $this->references; |
118 | 118 | } |
119 | 119 | $this->references = new ArrayList(); |
120 | 120 | |
121 | 121 | // Add tags |
122 | - foreach($this->commit->resolveReferences() as $reference) { |
|
123 | - if($reference instanceof \Gitonomy\Git\Reference\Tag) { |
|
122 | + foreach ($this->commit->resolveReferences() as $reference) { |
|
123 | + if ($reference instanceof \Gitonomy\Git\Reference\Tag) { |
|
124 | 124 | $this->references->push(new ArrayData(array( |
125 | 125 | 'Name' => $reference->getName(), |
126 | 126 | 'Type' => 'Tag', |
@@ -151,16 +151,16 @@ discard block |
||
151 | 151 | public function CurrentlyDeployedTo() { |
152 | 152 | $environments = $this->project->Environments(); |
153 | 153 | $envList = new ArrayList(); |
154 | - foreach($environments as $environment) { |
|
154 | + foreach ($environments as $environment) { |
|
155 | 155 | $deployments = DNDeployment::get() |
156 | 156 | ->filter('State', 'Completed') |
157 | 157 | ->filter('EnvironmentID', $environment->ID) |
158 | 158 | ->sort('LastEdited DESC'); |
159 | - if(!$deployments->count()) { |
|
159 | + if (!$deployments->count()) { |
|
160 | 160 | continue; |
161 | 161 | } |
162 | 162 | $latest = $deployments->first(); |
163 | - if($latest->SHA === $this->commit->getHash()) { |
|
163 | + if ($latest->SHA === $this->commit->getHash()) { |
|
164 | 164 | $envList->push($environment); |
165 | 165 | } |
166 | 166 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function EverDeployedTo($environmentName) { |
175 | 175 | $environments = $this->project->Environments()->filter('Name', $environmentName); |
176 | - if(!$environments->count()) { |
|
176 | + if (!$environments->count()) { |
|
177 | 177 | return false; |
178 | 178 | } |
179 | 179 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | ->filter('State', 'Completed') |
184 | 184 | ->filter('EnvironmentID', $environment->ID); |
185 | 185 | |
186 | - if($deployments->count()) { |
|
186 | + if ($deployments->count()) { |
|
187 | 187 | return true; |
188 | 188 | } |
189 | 189 |
@@ -100,24 +100,24 @@ discard block |
||
100 | 100 | protected function getReferences() { |
101 | 101 | try { |
102 | 102 | $repository = new Gitonomy\Git\Repository($this->project->getLocalCVSPath()); |
103 | - } catch(Exception $e) { |
|
103 | + } catch (Exception $e) { |
|
104 | 104 | return array(); |
105 | 105 | } |
106 | 106 | |
107 | - if($this->getTags) { |
|
108 | - if($this->reference) { |
|
107 | + if ($this->getTags) { |
|
108 | + if ($this->reference) { |
|
109 | 109 | throw new LogicException("Can't have \$reference and \$getTags both set"); |
110 | 110 | } |
111 | 111 | $log = $repository->getReferences()->getTags(); |
112 | 112 | |
113 | - } else if($this->reference) { |
|
113 | + } else if ($this->reference) { |
|
114 | 114 | $log = $this->reference->getLog(); |
115 | 115 | } else { |
116 | 116 | $log = $repository->getLog(); |
117 | 117 | } |
118 | 118 | |
119 | - if($this->limit) { |
|
120 | - if(is_array($log)) { |
|
119 | + if ($this->limit) { |
|
120 | + if (is_array($log)) { |
|
121 | 121 | $limitedLog = array_slice($log, 0, $this->limit); |
122 | 122 | } else { |
123 | 123 | $limitedLog = $log->setLimit($this->limit); |
@@ -128,18 +128,18 @@ discard block |
||
128 | 128 | |
129 | 129 | // cache them for look up in byName |
130 | 130 | $builds = array(); |
131 | - foreach($limitedLog as $reference) { |
|
132 | - if(!empty($this->blockBranch)) { |
|
131 | + foreach ($limitedLog as $reference) { |
|
132 | + if (!empty($this->blockBranch)) { |
|
133 | 133 | $branchesIncluding = GitonomyCache::getIncludingBranches($reference); |
134 | - foreach($branchesIncluding as $candidate) { |
|
135 | - if($candidate->getName() == $this->blockBranch) { |
|
134 | + foreach ($branchesIncluding as $candidate) { |
|
135 | + if ($candidate->getName() == $this->blockBranch) { |
|
136 | 136 | // Break out of the function |
137 | 137 | return $builds; |
138 | 138 | } |
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | - if($this->getTags) { |
|
142 | + if ($this->getTags) { |
|
143 | 143 | $builds[] = DNTag::create($reference, $this->project, $this->data); |
144 | 144 | } else { |
145 | 145 | $name = $this->reference ? $this->reference->getName() : ''; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @return DNCommit |
158 | 158 | */ |
159 | 159 | public function byName($hash) { |
160 | - if($this->loaded === false) { |
|
160 | + if ($this->loaded === false) { |
|
161 | 161 | $this->items = $this->getReferences(); |
162 | 162 | $this->loaded = true; |
163 | 163 | } |
@@ -165,14 +165,14 @@ discard block |
||
165 | 165 | // The item might not be in the list because of the limit, try to find |
166 | 166 | // in an older version and add it to the list. |
167 | 167 | $found = null; |
168 | - foreach($this->items as $item) { |
|
169 | - if($item->SHA() == $hash) { |
|
168 | + foreach ($this->items as $item) { |
|
169 | + if ($item->SHA() == $hash) { |
|
170 | 170 | $found = $item; |
171 | 171 | break; |
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | - if($found === null) { |
|
175 | + if ($found === null) { |
|
176 | 176 | $repository = new Gitonomy\Git\Repository($this->project->getLocalCVSPath()); |
177 | 177 | $commit = new Gitonomy\Git\Commit($repository, $hash); |
178 | 178 | $found = DNCommit::create($commit, $this->project, $this->data); |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | * @return ArrayIterator |
194 | 194 | */ |
195 | 195 | public function getIterator() { |
196 | - if($this->loaded === false) { |
|
196 | + if ($this->loaded === false) { |
|
197 | 197 | $this->items = $this->getReferences(); |
198 | 198 | $this->loaded = true; |
199 | 199 | } |
200 | - foreach($this->items as $item) { |
|
201 | - if(is_array($item)) { |
|
200 | + foreach ($this->items as $item) { |
|
201 | + if (is_array($item)) { |
|
202 | 202 | $this->items[] = new ArrayData($item); |
203 | 203 | } |
204 | 204 | } |
@@ -20,13 +20,13 @@ discard block |
||
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(); |
27 | 27 | $backupDataTransfer = null; |
28 | 28 | |
29 | - if( |
|
29 | + if ( |
|
30 | 30 | !empty($this->args['backupBeforePush']) |
31 | 31 | && $this->args['backupBeforePush'] !== 'false' |
32 | 32 | && $dataTransfer->Direction == 'push' |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'Created:GreaterThan' => strtotime('-30 minutes') |
55 | 55 | )) |
56 | 56 | ->exclude('ID', $dataTransfer->ID); |
57 | - if($runningTransfers->count()) { |
|
57 | + if ($runningTransfers->count()) { |
|
58 | 58 | $runningTransfer = $runningTransfers->first(); |
59 | 59 | $message = sprintf( |
60 | 60 | 'Error: another transfer is in progress (started at %s by %s)', |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | |
68 | 68 | $this->performBackup($backupDataTransfer, $log); |
69 | 69 | $environment->Backend()->dataTransfer($dataTransfer, $log); |
70 | - } catch(Exception $e) { |
|
71 | - echo "[-] DataTransferJob failed" . PHP_EOL; |
|
70 | + } catch (Exception $e) { |
|
71 | + echo "[-] DataTransferJob failed".PHP_EOL; |
|
72 | 72 | throw $e; |
73 | 73 | } |
74 | 74 | |
75 | 75 | $this->updateStatus('Finished'); |
76 | - echo "[-] DataTransferJob finished" . PHP_EOL; |
|
76 | + echo "[-] DataTransferJob finished".PHP_EOL; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | protected function performBackup($backupDataTransfer, DeploynautLogFile $log) { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | DB::connect($databaseConfig); |
89 | 89 | $backupDataTransfer->Status = 'Finished'; |
90 | 90 | $backupDataTransfer->write(); |
91 | - } catch(Exception $e) { |
|
91 | + } catch (Exception $e) { |
|
92 | 92 | global $databaseConfig; |
93 | 93 | DB::connect($databaseConfig); |
94 | 94 | $backupDataTransfer->Status = 'Failed'; |