@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | public function LogLink() { |
| 104 | - return $this->Link() . '/log'; |
|
| 104 | + return $this->Link().'/log'; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public function canView($member = null) { |
@@ -177,18 +177,18 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public function getCommitURL() { |
| 179 | 179 | $environment = $this->Environment(); |
| 180 | - if (!$environment) { |
|
| 180 | + if(!$environment) { |
|
| 181 | 181 | return null; |
| 182 | 182 | } |
| 183 | 183 | $project = $environment->Project(); |
| 184 | - if (!$project) { |
|
| 184 | + if(!$project) { |
|
| 185 | 185 | return null; |
| 186 | 186 | } |
| 187 | 187 | $interface = $project->getRepositoryInterface(); |
| 188 | - if (!$interface) { |
|
| 188 | + if(!$interface) { |
|
| 189 | 189 | return null; |
| 190 | 190 | } |
| 191 | - return $interface->CommitURL . '/' . $this->SHA; |
|
| 191 | + return $interface->CommitURL.'/'.$this->SHA; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -237,12 +237,12 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | public function getFullDeployMessages() { |
| 239 | 239 | $strategy = $this->getDeploymentStrategy(); |
| 240 | - if ($strategy->getActionCode()!=='full') return null; |
|
| 240 | + if($strategy->getActionCode() !== 'full') return null; |
|
| 241 | 241 | |
| 242 | 242 | $changes = $strategy->getChangesModificationNeeded(); |
| 243 | 243 | $messages = []; |
| 244 | - foreach ($changes as $change => $details) { |
|
| 245 | - if ($change==='Code version') continue; |
|
| 244 | + foreach($changes as $change => $details) { |
|
| 245 | + if($change === 'Code version') continue; |
|
| 246 | 246 | |
| 247 | 247 | $messages[] = [ |
| 248 | 248 | 'Flag' => sprintf( |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | ]; |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - if (empty($messages)) { |
|
| 256 | + if(empty($messages)) { |
|
| 257 | 257 | $messages[] = [ |
| 258 | 258 | 'Flag' => '', |
| 259 | 259 | 'Text' => '<i>Environment changes have been made.</i>' |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | // if there is a compare URL, and a description or a change (something actually changed) |
| 304 | 304 | // then show the URL. Otherwise don't show anything, as there is no comparison to be made. |
| 305 | - if ($changed || $description) { |
|
| 305 | + if($changed || $description) { |
|
| 306 | 306 | $compareUrl = isset($change['compareUrl']) ? $change['compareUrl'] : ''; |
| 307 | 307 | } |
| 308 | 308 | |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | |
| 367 | 367 | public function getSigFile() { |
| 368 | 368 | $dir = DNData::inst()->getSignalDir(); |
| 369 | - if (!is_dir($dir)) { |
|
| 369 | + if(!is_dir($dir)) { |
|
| 370 | 370 | `mkdir $dir`; |
| 371 | 371 | } |
| 372 | 372 | return sprintf( |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | $this->project = $this->getCurrentProject(); |
| 43 | 43 | |
| 44 | - if (!$this->project) { |
|
| 44 | + if(!$this->project) { |
|
| 45 | 45 | return $this->project404Response(); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | // Performs canView permission check by limiting visible projects |
| 49 | 49 | $this->environment = $this->getCurrentEnvironment($this->project); |
| 50 | - if (!$this->environment) { |
|
| 50 | + if(!$this->environment) { |
|
| 51 | 51 | return $this->environment404Response(); |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -68,19 +68,19 @@ discard block |
||
| 68 | 68 | $data = []; |
| 69 | 69 | $list = $this->DeployHistory(); |
| 70 | 70 | $page = $request->getVar('page') ?: 1; |
| 71 | - if ($page > $list->TotalPages()) { |
|
| 71 | + if($page > $list->TotalPages()) { |
|
| 72 | 72 | $page = 1; |
| 73 | 73 | } |
| 74 | - if ($page < 1) { |
|
| 74 | + if($page < 1) { |
|
| 75 | 75 | $page = 1; |
| 76 | 76 | } |
| 77 | 77 | $start = ($page - 1) * $list->getPageLength(); |
| 78 | - $list->setPageStart((int) $start); |
|
| 79 | - if (empty($list)) { |
|
| 78 | + $list->setPageStart((int)$start); |
|
| 79 | + if(empty($list)) { |
|
| 80 | 80 | return $this->getAPIResponse(['list' => []], 200); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - foreach ($list as $deployment) { |
|
| 83 | + foreach($list as $deployment) { |
|
| 84 | 84 | $data[] = $this->getDeploymentData($deployment); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function currentbuild(SS_HTTPRequest $request) { |
| 100 | 100 | $currentBuild = $this->environment->CurrentBuild(); |
| 101 | - if (!$currentBuild) { |
|
| 101 | + if(!$currentBuild) { |
|
| 102 | 102 | return $this->getAPIResponse(['deployment' => []], 200); |
| 103 | 103 | } |
| 104 | 104 | return $this->getAPIResponse(['deployment' => $this->getDeploymentData($currentBuild)], 200); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | public function show(SS_HTTPRequest $request) { |
| 112 | 112 | $deployment = DNDeployment::get()->byId($request->param('ID')); |
| 113 | 113 | $errorResponse = $this->validateDeployments($deployment); |
| 114 | - if ($errorResponse instanceof \SS_HTTPResponse) { |
|
| 114 | + if($errorResponse instanceof \SS_HTTPResponse) { |
|
| 115 | 115 | return $errorResponse; |
| 116 | 116 | } |
| 117 | 117 | return $this->getAPIResponse(['deployment' => $this->getDeploymentData($deployment)], 200); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | public function log(SS_HTTPRequest $request) { |
| 125 | 125 | $deployment = DNDeployment::get()->byId($request->param('ID')); |
| 126 | 126 | $errorResponse = $this->validateDeployments($deployment); |
| 127 | - if ($errorResponse instanceof \SS_HTTPResponse) { |
|
| 127 | + if($errorResponse instanceof \SS_HTTPResponse) { |
|
| 128 | 128 | return $errorResponse; |
| 129 | 129 | } |
| 130 | 130 | $log = $deployment->log(); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | public function start(SS_HTTPRequest $request) { |
| 142 | 142 | $this->checkSecurityToken(); |
| 143 | 143 | |
| 144 | - if (!$this->environment->canDeploy(Member::currentUser())) { |
|
| 144 | + if(!$this->environment->canDeploy(Member::currentUser())) { |
|
| 145 | 145 | return $this->getAPIResponse(['message' => 'You are not authorised to deploy this environment'], 403); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -197,12 +197,12 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | $deployer = $deployment->Deployer(); |
| 199 | 199 | $deployerData = null; |
| 200 | - if ($deployer && $deployer->exists()) { |
|
| 200 | + if($deployer && $deployer->exists()) { |
|
| 201 | 201 | $deployerData = $this->getStackMemberData($deployer); |
| 202 | 202 | } |
| 203 | 203 | $approver = $deployment->Approver(); |
| 204 | 204 | $approverData = null; |
| 205 | - if ($approver && $approver->exists()) { |
|
| 205 | + if($approver && $approver->exists()) { |
|
| 206 | 206 | $approverData = $this->getStackMemberData($approver); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -236,8 +236,8 @@ discard block |
||
| 236 | 236 | $stackMembers = $this->project->listMembers(); |
| 237 | 237 | $role = null; |
| 238 | 238 | |
| 239 | - foreach ($stackMembers as $stackMember) { |
|
| 240 | - if ($stackMember['MemberID'] !== $member->ID) { |
|
| 239 | + foreach($stackMembers as $stackMember) { |
|
| 240 | + if($stackMember['MemberID'] !== $member->ID) { |
|
| 241 | 241 | continue; |
| 242 | 242 | } |
| 243 | 243 | |
@@ -261,10 +261,10 @@ discard block |
||
| 261 | 261 | * @return null|SS_HTTPResponse |
| 262 | 262 | */ |
| 263 | 263 | protected function validateDeployments(\DNDeployment $deployment) { |
| 264 | - if (!$deployment || !$deployment->exists()) { |
|
| 264 | + if(!$deployment || !$deployment->exists()) { |
|
| 265 | 265 | return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404); |
| 266 | 266 | } |
| 267 | - if (!$deployment->canView()) { |
|
| 267 | + if(!$deployment->canView()) { |
|
| 268 | 268 | return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403); |
| 269 | 269 | } |
| 270 | 270 | return null; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | public function getModel($name) { |
| 19 | 19 | $deployment = $this->getDeployment(); |
| 20 | - if (!$deployment) { |
|
| 20 | + if(!$deployment) { |
|
| 21 | 21 | return []; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function getDeployment() { |
| 30 | 30 | $id = $this->request->param('Id'); |
| 31 | 31 | $deployment = DNDeployment::get()->byId($id); |
| 32 | - if (!$deployment || !$deployment->exists()) { |
|
| 32 | + if(!$deployment || !$deployment->exists()) { |
|
| 33 | 33 | return false; |
| 34 | 34 | } |
| 35 | 35 | return $deployment; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function apply(SS_HTTPRequest $request) { |
| 39 | 39 | $this->checkSecurityToken(); |
| 40 | 40 | $response = $this->checkRequest(); |
| 41 | - if ($response instanceof SS_HTTPResponse) { |
|
| 41 | + if($response instanceof SS_HTTPResponse) { |
|
| 42 | 42 | return $response; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function canApply(SS_HTTPRequest $request) { |
| 53 | 53 | $this->checkSecurityToken(); |
| 54 | 54 | $response = $this->checkRequest(); |
| 55 | - if ($response instanceof SS_HTTPResponse) { |
|
| 55 | + if($response instanceof SS_HTTPResponse) { |
|
| 56 | 56 | return $response; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -63,17 +63,17 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | protected function checkRequest() { |
| 65 | 65 | $project = $this->getCurrentProject(); |
| 66 | - if (!$project) { |
|
| 66 | + if(!$project) { |
|
| 67 | 67 | return $this->project404Response(); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | $env = $this->getCurrentEnvironment($project); |
| 71 | - if (!$env) { |
|
| 71 | + if(!$env) { |
|
| 72 | 72 | return $this->environment404Response(); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $deployment = $this->getDeployment(); |
| 76 | - if (!$deployment) { |
|
| 76 | + if(!$deployment) { |
|
| 77 | 77 | return new SS_HTTPResponse('Deployment not found', 404); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | protected function getMachine() { |
| 84 | 84 | $deployment = $this->getDeployment(); |
| 85 | - if (!$deployment) { |
|
| 85 | + if(!$deployment) { |
|
| 86 | 86 | return null; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -94,10 +94,10 @@ discard block |
||
| 94 | 94 | // It gives a chance to perform a dry-run, and reject the transition, for example |
| 95 | 95 | // in case the user is unauthorised. |
| 96 | 96 | 'finite.test_transition', |
| 97 | - function (Finite\Event\TransitionEvent $e) use ($project) { |
|
| 97 | + function(Finite\Event\TransitionEvent $e) use ($project) { |
|
| 98 | 98 | $code = null; |
| 99 | 99 | |
| 100 | - switch ($e->getTransition()->getName()) { |
|
| 100 | + switch($e->getTransition()->getName()) { |
|
| 101 | 101 | case DNDeployment::TR_SUBMIT: |
| 102 | 102 | $code = self::ALLOW_DNDEPLOYMENT_SUBMIT; |
| 103 | 103 | break; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | break; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if (!$code || !$project->allowed($code)) { |
|
| 109 | + if(!$code || !$project->allowed($code)) { |
|
| 110 | 110 | $e->reject(); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $this->project = $this->getCurrentProject(); |
| 39 | 39 | |
| 40 | - if (!$this->project) { |
|
| 40 | + if(!$this->project) { |
|
| 41 | 41 | return $this->project404Response(); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // Performs canView permission check by limiting visible projects |
| 45 | 45 | $this->environment = $this->getCurrentEnvironment($this->project); |
| 46 | - if (!$this->environment) { |
|
| 46 | + if(!$this->environment) { |
|
| 47 | 47 | return $this->environment404Response(); |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function deploysummary(SS_HTTPRequest $request) { |
| 68 | 68 | |
| 69 | - if (strtolower($request->httpMethod()) !== 'post') { |
|
| 69 | + if(strtolower($request->httpMethod()) !== 'post') { |
|
| 70 | 70 | return $this->getAPIResponse(['message' => 'Method not allowed, requires POST'], 405); |
| 71 | 71 | } |
| 72 | 72 | $this->checkSecurityToken(); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $data = $strategy->toArray(); |
| 82 | 82 | |
| 83 | 83 | $interface = $this->project->getRepositoryInterface(); |
| 84 | - if ($this->canCompareCodeVersions($interface, $data['changes'])) { |
|
| 84 | + if($this->canCompareCodeVersions($interface, $data['changes'])) { |
|
| 85 | 85 | $compareurl = sprintf( |
| 86 | 86 | '%s/compare/%s...%s', |
| 87 | 87 | $interface->URL, |
@@ -118,20 +118,20 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | */ |
| 120 | 120 | protected function canCompareCodeVersions(\ArrayData $interface, $changes) { |
| 121 | - if (empty($changes['Code version'])) { |
|
| 121 | + if(empty($changes['Code version'])) { |
|
| 122 | 122 | return false; |
| 123 | 123 | } |
| 124 | 124 | $codeVersion = ['Code version']; |
| 125 | - if (empty($interface)) { |
|
| 125 | + if(empty($interface)) { |
|
| 126 | 126 | return false; |
| 127 | 127 | } |
| 128 | - if (empty($interface->URL)) { |
|
| 128 | + if(empty($interface->URL)) { |
|
| 129 | 129 | return false; |
| 130 | 130 | } |
| 131 | - if (empty($codeVersion['from']) || empty($codeVersion['to'])) { |
|
| 131 | + if(empty($codeVersion['from']) || empty($codeVersion['to'])) { |
|
| 132 | 132 | return false; |
| 133 | 133 | } |
| 134 | - if (strlen($codeVersion['from']) !== 40 || strlen($codeVersion['to']) !== 40) { |
|
| 134 | + if(strlen($codeVersion['from']) !== 40 || strlen($codeVersion['to']) !== 40) { |
|
| 135 | 135 | return false; |
| 136 | 136 | } |
| 137 | 137 | return true; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function asJSONValidatorErrors($code, $validatorErrors) { |
| 52 | 52 | $fieldErrors = []; |
| 53 | - foreach ($validatorErrors as $error) { |
|
| 53 | + foreach($validatorErrors as $error) { |
|
| 54 | 54 | $fieldErrors[$error['fieldName']] = $error['message']; |
| 55 | 55 | } |
| 56 | 56 | return $this->asJSONFormFieldErrors($code, $fieldErrors); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | // To get around that, upon spotting an active redirect, we change the response code to 200, |
| 96 | 96 | // and move the redirect into the "RedirectTo" field in the JSON response. Frontend can |
| 97 | 97 | // then interpret this and trigger a redirect. |
| 98 | - if ($this->redirectedTo()) { |
|
| 98 | + if($this->redirectedTo()) { |
|
| 99 | 99 | $data['RedirectTo'] = $this->response->getHeader('Location'); |
| 100 | 100 | // Pop off the header - we are no longer redirecting via the usual mechanism. |
| 101 | 101 | $this->response->removeHeader('Location'); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | protected function checkSecurityToken() { |
| 130 | 130 | $securityToken = $this->getSecurityToken(); |
| 131 | - if (!$securityToken->check($this->request->postVar(self::SECURITY_TOKEN_NAME))) { |
|
| 131 | + if(!$securityToken->check($this->request->postVar(self::SECURITY_TOKEN_NAME))) { |
|
| 132 | 132 | $this->httpError(403, 'Invalid security token, try reloading the page.'); |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -163,8 +163,8 @@ discard block |
||
| 163 | 163 | * @return string|array |
| 164 | 164 | */ |
| 165 | 165 | protected function trimWhitespace($val) { |
| 166 | - if (is_array($val)) { |
|
| 167 | - foreach ($val as $k => $v) { |
|
| 166 | + if(is_array($val)) { |
|
| 167 | + foreach($val as $k => $v) { |
|
| 168 | 168 | $val[$k] = $this->trimWhitespace($v); |
| 169 | 169 | } |
| 170 | 170 | return $val; |
@@ -180,8 +180,8 @@ discard block |
||
| 180 | 180 | * @return string|array |
| 181 | 181 | */ |
| 182 | 182 | protected function stripNonPrintables($val) { |
| 183 | - if (is_array($val)) { |
|
| 184 | - foreach ($val as $k => $v) { |
|
| 183 | + if(is_array($val)) { |
|
| 184 | + foreach($val as $k => $v) { |
|
| 185 | 185 | $val[$k] = $this->stripNonPrintables($v); |
| 186 | 186 | } |
| 187 | 187 | return $val; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $this->project = $this->getCurrentProject(); |
| 40 | 40 | |
| 41 | - if (!$this->project) { |
|
| 41 | + if(!$this->project) { |
|
| 42 | 42 | return $this->project404Response(); |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * @return SS_HTTPResponse |
| 59 | 59 | */ |
| 60 | 60 | public function update(SS_HTTPRequest $request) { |
| 61 | - switch ($request->httpMethod()) { |
|
| 61 | + switch($request->httpMethod()) { |
|
| 62 | 62 | case 'POST': |
| 63 | 63 | $this->checkSecurityToken(); |
| 64 | 64 | return $this->createUpdate(); |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | // @todo: the original was a tree that was keyed by environment, the |
| 96 | 96 | // front-end dropdown needs to be changed to support that. brrrr. |
| 97 | 97 | $prevDeploys = []; |
| 98 | - foreach ($this->getGitPrevDeploys($this->project) as $env) { |
|
| 99 | - foreach ($env as $deploy) { |
|
| 98 | + foreach($this->getGitPrevDeploys($this->project) as $env) { |
|
| 99 | + foreach($env as $deploy) { |
|
| 100 | 100 | $prevDeploys[] = $deploy; |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | protected function getUpdateStatus($ID) { |
| 134 | 134 | $ping = DNGitFetch::get()->byID($ID); |
| 135 | - if (!$ping) { |
|
| 136 | - return $this->getAPIResponse(['message' => 'GIT update (' . $ID . ') not found'], 404); |
|
| 135 | + if(!$ping) { |
|
| 136 | + return $this->getAPIResponse(['message' => 'GIT update ('.$ID.') not found'], 404); |
|
| 137 | 137 | } |
| 138 | 138 | $output = [ |
| 139 | 139 | 'id' => $ID, |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $fetch->write(); |
| 155 | 155 | $fetch->start(); |
| 156 | 156 | |
| 157 | - $location = Director::absoluteBaseURL() . $this->Link() . '/update/' . $fetch->ID; |
|
| 157 | + $location = Director::absoluteBaseURL().$this->Link().'/update/'.$fetch->ID; |
|
| 158 | 158 | $output = [ |
| 159 | 159 | 'message' => 'git fetch has been queued', |
| 160 | 160 | 'id' => $fetch->ID, |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | protected function getGitBranches($project) { |
| 175 | 175 | $branches = []; |
| 176 | - foreach ($project->DNBranchList() as $branch) { |
|
| 176 | + foreach($project->DNBranchList() as $branch) { |
|
| 177 | 177 | $branches[] = [ |
| 178 | 178 | 'key' => $branch->SHA(), |
| 179 | 179 | 'value' => $branch->Name(), |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | protected function getGitTags($project) { |
| 191 | 191 | $tags = []; |
| 192 | - foreach ($project->DNTagList()->setLimit(null) as $tag) { |
|
| 192 | + foreach($project->DNTagList()->setLimit(null) as $tag) { |
|
| 193 | 193 | $tags[] = [ |
| 194 | 194 | 'key' => $tag->SHA(), |
| 195 | 195 | 'value' => $tag->Name(), |
@@ -205,14 +205,14 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | protected function getGitPrevDeploys($project) { |
| 207 | 207 | $redeploy = []; |
| 208 | - foreach ($project->DNEnvironmentList() as $dnEnvironment) { |
|
| 208 | + foreach($project->DNEnvironmentList() as $dnEnvironment) { |
|
| 209 | 209 | $envName = $dnEnvironment->Name; |
| 210 | 210 | $perEnvDeploys = []; |
| 211 | - foreach ($dnEnvironment->DeployHistory() as $deploy) { |
|
| 211 | + foreach($dnEnvironment->DeployHistory() as $deploy) { |
|
| 212 | 212 | $sha = $deploy->SHA; |
| 213 | 213 | |
| 214 | 214 | // Check if exists to make sure the newest deployment date is used. |
| 215 | - if (!isset($perEnvDeploys[$sha])) { |
|
| 215 | + if(!isset($perEnvDeploys[$sha])) { |
|
| 216 | 216 | $pastValue = sprintf( |
| 217 | 217 | "%s (deployed %s)", |
| 218 | 218 | substr($sha, 0, 8), |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | ]; |
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | - if (!empty($perEnvDeploys)) { |
|
| 227 | + if(!empty($perEnvDeploys)) { |
|
| 228 | 228 | $redeploy[$envName] = array_values($perEnvDeploys); |
| 229 | 229 | } |
| 230 | 230 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | public function init() { |
| 20 | 20 | parent::init(); |
| 21 | 21 | $this->project = $this->getCurrentProject(); |
| 22 | - if (!$this->project) { |
|
| 22 | + if(!$this->project) { |
|
| 23 | 23 | return $this->project404Response(); |
| 24 | 24 | } |
| 25 | 25 | // Performs canView permission check by limiting visible projects |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @return \HTMLText|\SS_HTTPResponse |
| 34 | 34 | */ |
| 35 | 35 | public function index(\SS_HTTPRequest $request) { |
| 36 | - if (!$this->environment) { |
|
| 36 | + if(!$this->environment) { |
|
| 37 | 37 | return $this->environment404Response(); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | $base = Director::absoluteBaseURL(); |
| 64 | 64 | return [ |
| 65 | 65 | 'dispatchers' => [ |
| 66 | - 'git' => $base . $this->getCurrentProject()->Link('git'), |
|
| 67 | - 'plan' => $base . $this->getCurrentEnvironment()->Link('plan'), |
|
| 68 | - 'deploys' => $base . $this->getCurrentEnvironment()->Link('deploys') |
|
| 66 | + 'git' => $base.$this->getCurrentProject()->Link('git'), |
|
| 67 | + 'plan' => $base.$this->getCurrentEnvironment()->Link('plan'), |
|
| 68 | + 'deploys' => $base.$this->getCurrentEnvironment()->Link('deploys') |
|
| 69 | 69 | ], |
| 70 | 70 | 'api_auth' => [ |
| 71 | 71 | 'name' => $this->getSecurityToken()->getName(), |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | public function getEditForm($id = null, $fields = null) { |
| 30 | 30 | $form = parent::getEditForm($id, $fields); |
| 31 | 31 | $gridField = $form->Fields()->dataFieldByName('DNProject'); |
| 32 | - if ($gridField) { |
|
| 32 | + if($gridField) { |
|
| 33 | 33 | $gridField->getConfig() |
| 34 | 34 | ->removeComponentsByType('GridFieldExportButton') |
| 35 | 35 | ->removeComponentsByType('GridFieldPrintButton') |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function __construct($logFile, $basePath = null) { |
| 17 | 17 | $this->logFile = $logFile; |
| 18 | - if ($basePath !== null) { |
|
| 18 | + if($basePath !== null) { |
|
| 19 | 19 | $this->basePath = $basePath; |
| 20 | - } else if (defined('DEPLOYNAUT_LOG_PATH')) { |
|
| 20 | + } else if(defined('DEPLOYNAUT_LOG_PATH')) { |
|
| 21 | 21 | $this->basePath = DEPLOYNAUT_LOG_PATH; |
| 22 | 22 | } else { |
| 23 | 23 | $this->basePath = sys_get_temp_dir(); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @return string |
| 46 | 46 | */ |
| 47 | 47 | public function getRawFilePath() { |
| 48 | - return $this->basePath . '/' . $this->logFile; |
|
| 48 | + return $this->basePath.'/'.$this->logFile; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @return string |
| 54 | 54 | */ |
| 55 | 55 | public function getSanitisedLogFilePath() { |
| 56 | - return $this->basePath . '/' . strtolower(FileNameFilter::create()->filter($this->logFile)); |
|
| 56 | + return $this->basePath.'/'.strtolower(FileNameFilter::create()->filter($this->logFile)); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | $path = $this->getSanitisedLogFilePath(); |
| 65 | 65 | |
| 66 | 66 | // for backwards compatibility on old logs |
| 67 | - if (!file_exists($path)) { |
|
| 67 | + if(!file_exists($path)) { |
|
| 68 | 68 | $path = $this->getRawFilePath(); |
| 69 | 69 | |
| 70 | - if (!file_exists($path)) { |
|
| 70 | + if(!file_exists($path)) { |
|
| 71 | 71 | return null; |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | // Make sure we write into the old path for existing logs. New logs use the sanitised file path instead. |
| 84 | 84 | $path = file_exists($this->getRawFilePath()) ? $this->getRawFilePath() : $this->getSanitisedLogFilePath(); |
| 85 | 85 | |
| 86 | - error_log('[' . date('Y-m-d H:i:s') . '] ' . $message . PHP_EOL, 3, $path); |
|
| 86 | + error_log('['.date('Y-m-d H:i:s').'] '.$message.PHP_EOL, 3, $path); |
|
| 87 | 87 | @chmod($path, 0666); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @return bool |
| 93 | 93 | */ |
| 94 | 94 | public function exists() { |
| 95 | - return (bool) $this->getLogFilePath(); |
|
| 95 | + return (bool)$this->getLogFilePath(); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |