@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * @return boolean true if $member can upload archives linked to this environment, false if they can't. |
255 | 255 | */ |
256 | 256 | public function canMoveTo($targetEnv, $member = null) { |
257 | - if ($this->Environment()->Project()->ID!=$targetEnv->Project()->ID) { |
|
257 | + if($this->Environment()->Project()->ID != $targetEnv->Project()->ID) { |
|
258 | 258 | // We don't permit moving snapshots between projects at this stage. |
259 | 259 | return false; |
260 | 260 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | if(Permission::checkMember($member, 'ADMIN')) return true; |
267 | 267 | |
268 | 268 | // Checks if the user can actually access the archive. |
269 | - if (!$this->canDownload($member)) return false; |
|
269 | + if(!$this->canDownload($member)) return false; |
|
270 | 270 | |
271 | 271 | // Hooks into ArchiveUploaders permission to prevent proliferation of permission checkboxes. |
272 | 272 | // Bypasses the quota check - we don't need to check for it as long as we move the snapshot within the project. |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $archive = $this; |
285 | 285 | $envs = $this->Environment()->Project()->DNEnvironmentList() |
286 | 286 | ->filterByCallback(function($item) use ($archive) { |
287 | - return $archive->EnvironmentID!=$item->ID && $archive->canMoveTo($item); |
|
287 | + return $archive->EnvironmentID != $item->ID && $archive->canMoveTo($item); |
|
288 | 288 | }); |
289 | 289 | |
290 | 290 | return $envs; |
@@ -207,7 +207,9 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function canRestore($member = null) { |
209 | 209 | $memberID = $member ? $member->ID : Member::currentUserID(); |
210 | - if(!$memberID) return false; |
|
210 | + if(!$memberID) { |
|
211 | + return false; |
|
212 | + } |
|
211 | 213 | |
212 | 214 | $key = $memberID . '-' . $this->EnvironmentID; |
213 | 215 | if(!isset(self::$_cache_can_restore[$key])) { |
@@ -226,7 +228,9 @@ discard block |
||
226 | 228 | */ |
227 | 229 | public function canDownload($member = null) { |
228 | 230 | $memberID = $member ? $member->ID : Member::currentUserID(); |
229 | - if(!$memberID) return false; |
|
231 | + if(!$memberID) { |
|
232 | + return false; |
|
233 | + } |
|
230 | 234 | |
231 | 235 | $key = $memberID . '-' . $this->EnvironmentID; |
232 | 236 | if(!isset(self::$_cache_can_download[$key])) { |
@@ -259,14 +263,23 @@ discard block |
||
259 | 263 | return false; |
260 | 264 | } |
261 | 265 | |
262 | - if(!$member) $member = Member::currentUser(); |
|
263 | - if(!$member) return false; // Must be logged in to check permissions |
|
266 | + if(!$member) { |
|
267 | + $member = Member::currentUser(); |
|
268 | + } |
|
269 | + if(!$member) { |
|
270 | + return false; |
|
271 | + } |
|
272 | + // Must be logged in to check permissions |
|
264 | 273 | |
265 | 274 | // Admin can always move. |
266 | - if(Permission::checkMember($member, 'ADMIN')) return true; |
|
275 | + if(Permission::checkMember($member, 'ADMIN')) { |
|
276 | + return true; |
|
277 | + } |
|
267 | 278 | |
268 | 279 | // Checks if the user can actually access the archive. |
269 | - if (!$this->canDownload($member)) return false; |
|
280 | + if (!$this->canDownload($member)) { |
|
281 | + return false; |
|
282 | + } |
|
270 | 283 | |
271 | 284 | // Hooks into ArchiveUploaders permission to prevent proliferation of permission checkboxes. |
272 | 285 | // Bypasses the quota check - we don't need to check for it as long as we move the snapshot within the project. |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | public function getCommits() { |
46 | - if (!isset($this->env)) { |
|
46 | + if(!isset($this->env)) { |
|
47 | 47 | $this->environmentNotSetException(); |
48 | 48 | } |
49 | 49 | $successfulCommits = |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | public function getLatestCommit() { |
57 | - if (!isset($this->env)) { |
|
57 | + if(!isset($this->env)) { |
|
58 | 58 | $this->environmentNotSetException(); |
59 | 59 | } |
60 | 60 | $commits = $this->getCommits(); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | public static $cache = array(); |
8 | 8 | |
9 | 9 | public static function getIncludingBranches($commit) { |
10 | - $cacheKey = 'getIncludingBranches-' .$commit->getRepository()->getPath() . '-' . $commit->gethash(); |
|
10 | + $cacheKey = 'getIncludingBranches-' . $commit->getRepository()->getPath() . '-' . $commit->gethash(); |
|
11 | 11 | if(!isset(self::$cache[$cacheKey])) { |
12 | 12 | self::$cache[$cacheKey] = $commit->getIncludingBranches(); |
13 | 13 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This class will queue a ping job and also proxy to the log file of that output |
|
4 | - */ |
|
3 | + * This class will queue a ping job and also proxy to the log file of that output |
|
4 | + */ |
|
5 | 5 | class DNPing extends DataObject { |
6 | 6 | |
7 | 7 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | return false; |
46 | 46 | } |
47 | 47 | case 'Queued': |
48 | - if ($this->Pipeline()->SkipSnapshot) { |
|
48 | + if($this->Pipeline()->SkipSnapshot) { |
|
49 | 49 | return $this->startDeploy(); |
50 | 50 | } else { |
51 | 51 | return $this->createSnapshot(); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | // Skip deployment for dry run |
86 | 86 | if($this->Pipeline()->DryRun) { |
87 | - $this->log("[Skipped] Create DNDeployment for SHA ".$pipeline->SHA); |
|
87 | + $this->log("[Skipped] Create DNDeployment for SHA " . $pipeline->SHA); |
|
88 | 88 | $this->write(); |
89 | 89 | return true; |
90 | 90 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | // check if we have timed out |
41 | - if ($this->isTimedOut()) { |
|
41 | + if($this->isTimedOut()) { |
|
42 | 42 | $this->log(sprintf(_t('EmergencyRollbackStep.ROLLBACKTIMEOUT', |
43 | 43 | "{$this->Title} is older than %s seconds and has timed out"), |
44 | 44 | $this->MaxDuration)); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ); |
86 | 86 | } |
87 | 87 | |
88 | - if ($this->Status == 'Queued') { |
|
88 | + if($this->Status == 'Queued') { |
|
89 | 89 | $this->start(); |
90 | 90 | } |
91 | 91 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->write(); |
97 | 97 | |
98 | 98 | // Rollback itself is handled by the Pipeline object. This step will be marked as failed. |
99 | - if ($this->Pipeline()->isRunning()) { |
|
99 | + if($this->Pipeline()->isRunning()) { |
|
100 | 100 | $this->Pipeline()->markFailed(); |
101 | 101 | return true; |
102 | 102 | } else { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function beginRollbackWindow() { |
129 | 129 | $this->Status = 'Started'; |
130 | - if (!$this->Started) $this->Started = SS_Datetime::now()->Rfc2822(); |
|
130 | + if(!$this->Started) $this->Started = SS_Datetime::now()->Rfc2822(); |
|
131 | 131 | $this->log(_t('EmergencyRollbackStep.BEGINROLLBACKWINDOW', |
132 | 132 | "{$this->Title} is beginning a rollback window...")); |
133 | 133 | $this->write(); |
@@ -127,7 +127,9 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function beginRollbackWindow() { |
129 | 129 | $this->Status = 'Started'; |
130 | - if (!$this->Started) $this->Started = SS_Datetime::now()->Rfc2822(); |
|
130 | + if (!$this->Started) { |
|
131 | + $this->Started = SS_Datetime::now()->Rfc2822(); |
|
132 | + } |
|
131 | 133 | $this->log(_t('EmergencyRollbackStep.BEGINROLLBACKWINDOW', |
132 | 134 | "{$this->Title} is beginning a rollback window...")); |
133 | 135 | $this->write(); |
@@ -138,7 +140,9 @@ discard block |
||
138 | 140 | |
139 | 141 | public function getRunningDescription() { |
140 | 142 | // Don't show options if this step has already been confirmed |
141 | - if($this->RolledBack) return; |
|
143 | + if($this->RolledBack) { |
|
144 | + return; |
|
145 | + } |
|
142 | 146 | |
143 | 147 | return _t('EmergencyRollbackStep.RUNNINGDESCRIPTION', |
144 | 148 | 'You may now roll back to the previous version, if needed.'); |
@@ -41,7 +41,9 @@ |
||
41 | 41 | if($this->Started) { |
42 | 42 | $started = intval($this->dbObject('Started')->Format('U')); |
43 | 43 | $now = intval(SS_Datetime::now()->Format('U')); |
44 | - if($started && $now) return $now - $started; |
|
44 | + if($started && $now) { |
|
45 | + return $now - $started; |
|
46 | + } |
|
45 | 47 | } |
46 | 48 | return 0; |
47 | 49 | } |
@@ -219,7 +219,7 @@ |
||
219 | 219 | * @return boolean |
220 | 220 | */ |
221 | 221 | protected function doRestoreDB() { |
222 | - if ($this->Pipeline()->SkipSnapshot) return false; |
|
222 | + if($this->Pipeline()->SkipSnapshot) return false; |
|
223 | 223 | |
224 | 224 | return $this->getConfigSetting('RestoreDB') && $this->Pipeline()->PreviousSnapshot(); |
225 | 225 | } |
@@ -219,7 +219,9 @@ |
||
219 | 219 | * @return boolean |
220 | 220 | */ |
221 | 221 | protected function doRestoreDB() { |
222 | - if ($this->Pipeline()->SkipSnapshot) return false; |
|
222 | + if ($this->Pipeline()->SkipSnapshot) { |
|
223 | + return false; |
|
224 | + } |
|
223 | 225 | |
224 | 226 | return $this->getConfigSetting('RestoreDB') && $this->Pipeline()->PreviousSnapshot(); |
225 | 227 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | foreach($environments as $environment) { |
15 | 15 | $newFilename = basename($environment->Filename); |
16 | 16 | if($environment->Filename != $newFilename) { |
17 | - echo 'Migrating "'.$environment->Filename.'" to '.$newFilename.PHP_EOL; |
|
17 | + echo 'Migrating "' . $environment->Filename . '" to ' . $newFilename . PHP_EOL; |
|
18 | 18 | $environment->Filename = $newFilename; |
19 | 19 | $environment->write(); |
20 | 20 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | foreach($projects as $project) { |
27 | 27 | if(!$project->projectFolderExists()) { |
28 | 28 | $warnings = true; |
29 | - echo 'Project '.$project->Name.' don\'t have a cap project folder'.PHP_EOL; |
|
29 | + echo 'Project ' . $project->Name . ' don\'t have a cap project folder' . PHP_EOL; |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | if($warnings) { |