@@ -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 | /** |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | Requirements::javascript('deploynaut/javascript/material.js'); |
| 179 | 179 | |
| 180 | 180 | // Load the buildable dependencies only if not loaded centrally. |
| 181 | - if (!is_dir(BASE_PATH . DIRECTORY_SEPARATOR . 'static')) { |
|
| 182 | - if (\Director::isDev()) { |
|
| 181 | + if(!is_dir(BASE_PATH.DIRECTORY_SEPARATOR.'static')) { |
|
| 182 | + if(\Director::isDev()) { |
|
| 183 | 183 | \Requirements::javascript('deploynaut/static/bundle-debug.js'); |
| 184 | 184 | } else { |
| 185 | 185 | \Requirements::javascript('deploynaut/static/bundle.js'); |
@@ -197,13 +197,13 @@ discard block |
||
| 197 | 197 | * @return boolean |
| 198 | 198 | */ |
| 199 | 199 | public static function FlagSnapshotsEnabled() { |
| 200 | - if (defined('FLAG_SNAPSHOTS_ENABLED') && FLAG_SNAPSHOTS_ENABLED) { |
|
| 200 | + if(defined('FLAG_SNAPSHOTS_ENABLED') && FLAG_SNAPSHOTS_ENABLED) { |
|
| 201 | 201 | return true; |
| 202 | 202 | } |
| 203 | - if (defined('FLAG_SNAPSHOTS_ENABLED_FOR_MEMBERS') && FLAG_SNAPSHOTS_ENABLED_FOR_MEMBERS) { |
|
| 203 | + if(defined('FLAG_SNAPSHOTS_ENABLED_FOR_MEMBERS') && FLAG_SNAPSHOTS_ENABLED_FOR_MEMBERS) { |
|
| 204 | 204 | $allowedMembers = explode(';', FLAG_SNAPSHOTS_ENABLED_FOR_MEMBERS); |
| 205 | 205 | $member = Member::currentUser(); |
| 206 | - if ($allowedMembers && $member && in_array($member->Email, $allowedMembers)) { |
|
| 206 | + if($allowedMembers && $member && in_array($member->Email, $allowedMembers)) { |
|
| 207 | 207 | return true; |
| 208 | 208 | } |
| 209 | 209 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public static function get_support_links() { |
| 217 | 217 | $supportLinks = self::config()->support_links; |
| 218 | - if ($supportLinks) { |
|
| 218 | + if($supportLinks) { |
|
| 219 | 219 | return new ArrayList($supportLinks); |
| 220 | 220 | } |
| 221 | 221 | } |
@@ -237,12 +237,12 @@ discard block |
||
| 237 | 237 | public function init() { |
| 238 | 238 | parent::init(); |
| 239 | 239 | |
| 240 | - if (!Member::currentUser() && !Session::get('AutoLoginHash')) { |
|
| 240 | + if(!Member::currentUser() && !Session::get('AutoLoginHash')) { |
|
| 241 | 241 | return Security::permissionFailure(); |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | // Block framework jquery |
| 245 | - Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js'); |
|
| 245 | + Requirements::block(FRAMEWORK_DIR.'/thirdparty/jquery/jquery.js'); |
|
| 246 | 246 | |
| 247 | 247 | self::include_requirements(); |
| 248 | 248 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | * @return \SS_HTTPResponse |
| 262 | 262 | */ |
| 263 | 263 | public function index(SS_HTTPRequest $request) { |
| 264 | - return $this->redirect($this->Link() . 'projects/'); |
|
| 264 | + return $this->redirect($this->Link().'projects/'); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -317,11 +317,11 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | // Performs canView permission check by limiting visible projects |
| 319 | 319 | $project = $this->getCurrentProject(); |
| 320 | - if (!$project) { |
|
| 320 | + if(!$project) { |
|
| 321 | 321 | return $this->project404Response(); |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - if (!$project->canBackup()) { |
|
| 324 | + if(!$project->canBackup()) { |
|
| 325 | 325 | return new SS_HTTPResponse("Not allowed to create snapshots on any environments", 401); |
| 326 | 326 | } |
| 327 | 327 | |
@@ -343,11 +343,11 @@ discard block |
||
| 343 | 343 | |
| 344 | 344 | // Performs canView permission check by limiting visible projects |
| 345 | 345 | $project = $this->getCurrentProject(); |
| 346 | - if (!$project) { |
|
| 346 | + if(!$project) { |
|
| 347 | 347 | return $this->project404Response(); |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - if (!$project->canUploadArchive()) { |
|
| 350 | + if(!$project->canUploadArchive()) { |
|
| 351 | 351 | return new SS_HTTPResponse("Not allowed to upload", 401); |
| 352 | 352 | } |
| 353 | 353 | |
@@ -378,22 +378,22 @@ discard block |
||
| 378 | 378 | public function getUploadSnapshotForm(SS_HTTPRequest $request) { |
| 379 | 379 | // Performs canView permission check by limiting visible projects |
| 380 | 380 | $project = $this->getCurrentProject(); |
| 381 | - if (!$project) { |
|
| 381 | + if(!$project) { |
|
| 382 | 382 | return $this->project404Response(); |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | - if (!$project->canUploadArchive()) { |
|
| 385 | + if(!$project->canUploadArchive()) { |
|
| 386 | 386 | return new SS_HTTPResponse("Not allowed to upload", 401); |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | // Framing an environment as a "group of people with download access" |
| 390 | 390 | // makes more sense to the user here, while still allowing us to enforce |
| 391 | 391 | // environment specific restrictions on downloading the file later on. |
| 392 | - $envs = $project->DNEnvironmentList()->filterByCallback(function ($item) { |
|
| 392 | + $envs = $project->DNEnvironmentList()->filterByCallback(function($item) { |
|
| 393 | 393 | return $item->canUploadArchive(); |
| 394 | 394 | }); |
| 395 | 395 | $envsMap = []; |
| 396 | - foreach ($envs as $env) { |
|
| 396 | + foreach($envs as $env) { |
|
| 397 | 397 | $envsMap[$env->ID] = $env->Name; |
| 398 | 398 | } |
| 399 | 399 | |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | $form->disableSecurityToken(); |
| 422 | 422 | $form->addExtraClass('fields-wide'); |
| 423 | 423 | // Tweak the action so it plays well with our fake URL structure. |
| 424 | - $form->setFormAction($project->Link() . '/UploadSnapshotForm'); |
|
| 424 | + $form->setFormAction($project->Link().'/UploadSnapshotForm'); |
|
| 425 | 425 | |
| 426 | 426 | return $form; |
| 427 | 427 | } |
@@ -437,18 +437,18 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | // Performs canView permission check by limiting visible projects |
| 439 | 439 | $project = $this->getCurrentProject(); |
| 440 | - if (!$project) { |
|
| 440 | + if(!$project) { |
|
| 441 | 441 | return $this->project404Response(); |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | $validEnvs = $project->DNEnvironmentList() |
| 445 | - ->filterByCallback(function ($item) { |
|
| 445 | + ->filterByCallback(function($item) { |
|
| 446 | 446 | return $item->canUploadArchive(); |
| 447 | 447 | }); |
| 448 | 448 | |
| 449 | 449 | // Validate $data['EnvironmentID'] by checking against $validEnvs. |
| 450 | 450 | $environment = $validEnvs->find('ID', $data['EnvironmentID']); |
| 451 | - if (!$environment) { |
|
| 451 | + if(!$environment) { |
|
| 452 | 452 | throw new LogicException('Invalid environment'); |
| 453 | 453 | } |
| 454 | 454 | |
@@ -471,9 +471,9 @@ discard block |
||
| 471 | 471 | $dataArchive->DataTransfers()->add($dataTransfer); |
| 472 | 472 | $form->saveInto($dataArchive); |
| 473 | 473 | $dataArchive->write(); |
| 474 | - $workingDir = TEMP_FOLDER . DIRECTORY_SEPARATOR . 'deploynaut-transfer-' . $dataTransfer->ID; |
|
| 474 | + $workingDir = TEMP_FOLDER.DIRECTORY_SEPARATOR.'deploynaut-transfer-'.$dataTransfer->ID; |
|
| 475 | 475 | |
| 476 | - $cleanupFn = function () use ($workingDir, $dataTransfer, $dataArchive) { |
|
| 476 | + $cleanupFn = function() use ($workingDir, $dataTransfer, $dataArchive) { |
|
| 477 | 477 | $process = new AbortableProcess(sprintf('rm -rf %s', escapeshellarg($workingDir))); |
| 478 | 478 | $process->setTimeout(120); |
| 479 | 479 | $process->run(); |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | // extract the sspak contents so we can inspect them |
| 485 | 485 | try { |
| 486 | 486 | $dataArchive->extractArchive($workingDir); |
| 487 | - } catch (Exception $e) { |
|
| 487 | + } catch(Exception $e) { |
|
| 488 | 488 | $cleanupFn(); |
| 489 | 489 | $form->sessionMessage( |
| 490 | 490 | 'There was a problem trying to open your snapshot for processing. Please try uploading again', |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | |
| 496 | 496 | // validate that the sspak contents match the declared contents |
| 497 | 497 | $result = $dataArchive->validateArchiveContents(); |
| 498 | - if (!$result->valid()) { |
|
| 498 | + if(!$result->valid()) { |
|
| 499 | 499 | $cleanupFn(); |
| 500 | 500 | $form->sessionMessage($result->message(), 'bad'); |
| 501 | 501 | return $this->redirectBack(); |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | try { |
| 506 | 506 | $dataArchive->fixArchivePermissions($workingDir); |
| 507 | 507 | $dataArchive->setArchiveFromFiles($workingDir); |
| 508 | - } catch (Exception $e) { |
|
| 508 | + } catch(Exception $e) { |
|
| 509 | 509 | $cleanupFn(); |
| 510 | 510 | $form->sessionMessage( |
| 511 | 511 | 'There was a problem processing your snapshot. Please try uploading again', |
@@ -536,22 +536,22 @@ discard block |
||
| 536 | 536 | public function getPostSnapshotForm(SS_HTTPRequest $request) { |
| 537 | 537 | // Performs canView permission check by limiting visible projects |
| 538 | 538 | $project = $this->getCurrentProject(); |
| 539 | - if (!$project) { |
|
| 539 | + if(!$project) { |
|
| 540 | 540 | return $this->project404Response(); |
| 541 | 541 | } |
| 542 | 542 | |
| 543 | - if (!$project->canUploadArchive()) { |
|
| 543 | + if(!$project->canUploadArchive()) { |
|
| 544 | 544 | return new SS_HTTPResponse("Not allowed to upload", 401); |
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | // Framing an environment as a "group of people with download access" |
| 548 | 548 | // makes more sense to the user here, while still allowing us to enforce |
| 549 | 549 | // environment specific restrictions on downloading the file later on. |
| 550 | - $envs = $project->DNEnvironmentList()->filterByCallback(function ($item) { |
|
| 550 | + $envs = $project->DNEnvironmentList()->filterByCallback(function($item) { |
|
| 551 | 551 | return $item->canUploadArchive(); |
| 552 | 552 | }); |
| 553 | 553 | $envsMap = []; |
| 554 | - foreach ($envs as $env) { |
|
| 554 | + foreach($envs as $env) { |
|
| 555 | 555 | $envsMap[$env->ID] = $env->Name; |
| 556 | 556 | } |
| 557 | 557 | |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | $form->disableSecurityToken(); |
| 574 | 574 | $form->addExtraClass('fields-wide'); |
| 575 | 575 | // Tweak the action so it plays well with our fake URL structure. |
| 576 | - $form->setFormAction($project->Link() . '/PostSnapshotForm'); |
|
| 576 | + $form->setFormAction($project->Link().'/PostSnapshotForm'); |
|
| 577 | 577 | |
| 578 | 578 | return $form; |
| 579 | 579 | } |
@@ -588,17 +588,17 @@ discard block |
||
| 588 | 588 | $this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 589 | 589 | |
| 590 | 590 | $project = $this->getCurrentProject(); |
| 591 | - if (!$project) { |
|
| 591 | + if(!$project) { |
|
| 592 | 592 | return $this->project404Response(); |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | - $validEnvs = $project->DNEnvironmentList()->filterByCallback(function ($item) { |
|
| 595 | + $validEnvs = $project->DNEnvironmentList()->filterByCallback(function($item) { |
|
| 596 | 596 | return $item->canUploadArchive(); |
| 597 | 597 | }); |
| 598 | 598 | |
| 599 | 599 | // Validate $data['EnvironmentID'] by checking against $validEnvs. |
| 600 | 600 | $environment = $validEnvs->find('ID', $data['EnvironmentID']); |
| 601 | - if (!$environment) { |
|
| 601 | + if(!$environment) { |
|
| 602 | 602 | throw new LogicException('Invalid environment'); |
| 603 | 603 | } |
| 604 | 604 | |
@@ -636,20 +636,20 @@ discard block |
||
| 636 | 636 | |
| 637 | 637 | // Performs canView permission check by limiting visible projects |
| 638 | 638 | $project = $this->getCurrentProject(); |
| 639 | - if (!$project) { |
|
| 639 | + if(!$project) { |
|
| 640 | 640 | return $this->project404Response(); |
| 641 | 641 | } |
| 642 | 642 | |
| 643 | - if (!$project->canUploadArchive()) { |
|
| 643 | + if(!$project->canUploadArchive()) { |
|
| 644 | 644 | return new SS_HTTPResponse("Not allowed to upload", 401); |
| 645 | 645 | } |
| 646 | 646 | |
| 647 | 647 | $dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 648 | - if (!$dataArchive) { |
|
| 648 | + if(!$dataArchive) { |
|
| 649 | 649 | return new SS_HTTPResponse("Archive not found.", 404); |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | - if (!$dataArchive->canRestore()) { |
|
| 652 | + if(!$dataArchive->canRestore()) { |
|
| 653 | 653 | throw new SS_HTTPResponse_Exception('Not allowed to restore archive', 403); |
| 654 | 654 | } |
| 655 | 655 | |
@@ -679,19 +679,19 @@ discard block |
||
| 679 | 679 | */ |
| 680 | 680 | public function toggleprojectstar(SS_HTTPRequest $request) { |
| 681 | 681 | $project = $this->getCurrentProject(); |
| 682 | - if (!$project) { |
|
| 682 | + if(!$project) { |
|
| 683 | 683 | return $this->project404Response(); |
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | $member = Member::currentUser(); |
| 687 | - if ($member === null) { |
|
| 687 | + if($member === null) { |
|
| 688 | 688 | return $this->project404Response(); |
| 689 | 689 | } |
| 690 | 690 | $favProject = $member->StarredProjects() |
| 691 | 691 | ->filter('DNProjectID', $project->ID) |
| 692 | 692 | ->first(); |
| 693 | 693 | |
| 694 | - if ($favProject) { |
|
| 694 | + if($favProject) { |
|
| 695 | 695 | $member->StarredProjects()->remove($favProject); |
| 696 | 696 | } else { |
| 697 | 697 | $member->StarredProjects()->add($project); |
@@ -705,14 +705,14 @@ discard block |
||
| 705 | 705 | */ |
| 706 | 706 | public function branch(SS_HTTPRequest $request) { |
| 707 | 707 | $project = $this->getCurrentProject(); |
| 708 | - if (!$project) { |
|
| 708 | + if(!$project) { |
|
| 709 | 709 | return $this->project404Response(); |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | $branchName = $request->getVar('name'); |
| 713 | 713 | $branch = $project->DNBranchList()->byName($branchName); |
| 714 | - if (!$branch) { |
|
| 715 | - return new SS_HTTPResponse("Branch '" . Convert::raw2xml($branchName) . "' not found.", 404); |
|
| 714 | + if(!$branch) { |
|
| 715 | + return new SS_HTTPResponse("Branch '".Convert::raw2xml($branchName)."' not found.", 404); |
|
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | return $this->render([ |
@@ -727,20 +727,20 @@ discard block |
||
| 727 | 727 | public function environment(SS_HTTPRequest $request) { |
| 728 | 728 | // Performs canView permission check by limiting visible projects |
| 729 | 729 | $project = $this->getCurrentProject(); |
| 730 | - if (!$project) { |
|
| 730 | + if(!$project) { |
|
| 731 | 731 | return $this->project404Response(); |
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | // Performs canView permission check by limiting visible projects |
| 735 | 735 | $env = $this->getCurrentEnvironment($project); |
| 736 | - if (!$env) { |
|
| 736 | + if(!$env) { |
|
| 737 | 737 | return $this->environment404Response(); |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | 740 | return $this->render([ |
| 741 | 741 | 'DNEnvironmentList' => $this->getCurrentProject()->DNEnvironmentList(), |
| 742 | 742 | 'FlagSnapshotsEnabled' => $this->FlagSnapshotsEnabled(), |
| 743 | - 'Redeploy' => (bool) $request->getVar('redeploy') |
|
| 743 | + 'Redeploy' => (bool)$request->getVar('redeploy') |
|
| 744 | 744 | ]); |
| 745 | 745 | } |
| 746 | 746 | |
@@ -752,22 +752,22 @@ discard block |
||
| 752 | 752 | */ |
| 753 | 753 | public function createenv(SS_HTTPRequest $request) { |
| 754 | 754 | $params = $request->params(); |
| 755 | - if ($params['Identifier']) { |
|
| 755 | + if($params['Identifier']) { |
|
| 756 | 756 | $record = DNCreateEnvironment::get()->byId($params['Identifier']); |
| 757 | 757 | |
| 758 | - if (!$record || !$record->ID) { |
|
| 758 | + if(!$record || !$record->ID) { |
|
| 759 | 759 | throw new SS_HTTPResponse_Exception('Create environment not found', 404); |
| 760 | 760 | } |
| 761 | - if (!$record->canView()) { |
|
| 761 | + if(!$record->canView()) { |
|
| 762 | 762 | return Security::permissionFailure(); |
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | $project = $this->getCurrentProject(); |
| 766 | - if (!$project) { |
|
| 766 | + if(!$project) { |
|
| 767 | 767 | return $this->project404Response(); |
| 768 | 768 | } |
| 769 | 769 | |
| 770 | - if ($project->Name != $params['Project']) { |
|
| 770 | + if($project->Name != $params['Project']) { |
|
| 771 | 771 | throw new LogicException("Project in URL doesn't match this creation"); |
| 772 | 772 | } |
| 773 | 773 | |
@@ -782,21 +782,21 @@ discard block |
||
| 782 | 782 | $params = $request->params(); |
| 783 | 783 | $env = DNCreateEnvironment::get()->byId($params['Identifier']); |
| 784 | 784 | |
| 785 | - if (!$env || !$env->ID) { |
|
| 785 | + if(!$env || !$env->ID) { |
|
| 786 | 786 | throw new SS_HTTPResponse_Exception('Log not found', 404); |
| 787 | 787 | } |
| 788 | - if (!$env->canView()) { |
|
| 788 | + if(!$env->canView()) { |
|
| 789 | 789 | return Security::permissionFailure(); |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | $project = $env->Project(); |
| 793 | 793 | |
| 794 | - if ($project->Name != $params['Project']) { |
|
| 794 | + if($project->Name != $params['Project']) { |
|
| 795 | 795 | throw new LogicException("Project in URL doesn't match this deploy"); |
| 796 | 796 | } |
| 797 | 797 | |
| 798 | 798 | $log = $env->log(); |
| 799 | - if ($log->exists()) { |
|
| 799 | + if($log->exists()) { |
|
| 800 | 800 | $content = $log->content(); |
| 801 | 801 | } else { |
| 802 | 802 | $content = 'Waiting for action to start'; |
@@ -813,27 +813,27 @@ discard block |
||
| 813 | 813 | $this->setCurrentActionType(self::ACTION_ENVIRONMENTS); |
| 814 | 814 | |
| 815 | 815 | $project = $this->getCurrentProject(); |
| 816 | - if (!$project) { |
|
| 816 | + if(!$project) { |
|
| 817 | 817 | return $this->project404Response(); |
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | $envType = $project->AllowedEnvironmentType; |
| 821 | - if (!$envType || !class_exists($envType)) { |
|
| 821 | + if(!$envType || !class_exists($envType)) { |
|
| 822 | 822 | return null; |
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | $backend = Injector::inst()->get($envType); |
| 826 | - if (!($backend instanceof EnvironmentCreateBackend)) { |
|
| 826 | + if(!($backend instanceof EnvironmentCreateBackend)) { |
|
| 827 | 827 | // Only allow this for supported backends. |
| 828 | 828 | return null; |
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | $fields = $backend->getCreateEnvironmentFields($project); |
| 832 | - if (!$fields) { |
|
| 832 | + if(!$fields) { |
|
| 833 | 833 | return null; |
| 834 | 834 | } |
| 835 | 835 | |
| 836 | - if (!$project->canCreateEnvironments()) { |
|
| 836 | + if(!$project->canCreateEnvironments()) { |
|
| 837 | 837 | return new SS_HTTPResponse('Not allowed to create environments for this project', 401); |
| 838 | 838 | } |
| 839 | 839 | |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | ); |
| 850 | 850 | |
| 851 | 851 | // Tweak the action so it plays well with our fake URL structure. |
| 852 | - $form->setFormAction($project->Link() . '/CreateEnvironmentForm'); |
|
| 852 | + $form->setFormAction($project->Link().'/CreateEnvironmentForm'); |
|
| 853 | 853 | |
| 854 | 854 | return $form; |
| 855 | 855 | } |
@@ -864,11 +864,11 @@ discard block |
||
| 864 | 864 | $this->setCurrentActionType(self::ACTION_ENVIRONMENTS); |
| 865 | 865 | |
| 866 | 866 | $project = $this->getCurrentProject(); |
| 867 | - if (!$project) { |
|
| 867 | + if(!$project) { |
|
| 868 | 868 | return $this->project404Response(); |
| 869 | 869 | } |
| 870 | 870 | |
| 871 | - if (!$project->canCreateEnvironments()) { |
|
| 871 | + if(!$project->canCreateEnvironments()) { |
|
| 872 | 872 | return new SS_HTTPResponse('Not allowed to create environments for this project', 401); |
| 873 | 873 | } |
| 874 | 874 | |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | $job->write(); |
| 883 | 883 | $job->start(); |
| 884 | 884 | |
| 885 | - return $this->redirect($project->Link('createenv') . '/' . $job->ID); |
|
| 885 | + return $this->redirect($project->Link('createenv').'/'.$job->ID); |
|
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | /** |
@@ -893,13 +893,13 @@ discard block |
||
| 893 | 893 | public function metrics(SS_HTTPRequest $request) { |
| 894 | 894 | // Performs canView permission check by limiting visible projects |
| 895 | 895 | $project = $this->getCurrentProject(); |
| 896 | - if (!$project) { |
|
| 896 | + if(!$project) { |
|
| 897 | 897 | return $this->project404Response(); |
| 898 | 898 | } |
| 899 | 899 | |
| 900 | 900 | // Performs canView permission check by limiting visible projects |
| 901 | 901 | $env = $this->getCurrentEnvironment($project); |
| 902 | - if (!$env) { |
|
| 902 | + if(!$env) { |
|
| 903 | 903 | return $this->environment404Response(); |
| 904 | 904 | } |
| 905 | 905 | |
@@ -922,11 +922,11 @@ discard block |
||
| 922 | 922 | */ |
| 923 | 923 | public function DNProjectList() { |
| 924 | 924 | $memberId = Member::currentUserID(); |
| 925 | - if (!$memberId) { |
|
| 925 | + if(!$memberId) { |
|
| 926 | 926 | return new ArrayList(); |
| 927 | 927 | } |
| 928 | 928 | |
| 929 | - if (Permission::check('ADMIN')) { |
|
| 929 | + if(Permission::check('ADMIN')) { |
|
| 930 | 930 | return DNProject::get(); |
| 931 | 931 | } |
| 932 | 932 | |
@@ -943,7 +943,7 @@ discard block |
||
| 943 | 943 | */ |
| 944 | 944 | public function getPlatformSpecificStrings() { |
| 945 | 945 | $strings = $this->config()->platform_specific_strings; |
| 946 | - if ($strings) { |
|
| 946 | + if($strings) { |
|
| 947 | 947 | return new ArrayList($strings); |
| 948 | 948 | } |
| 949 | 949 | } |
@@ -955,15 +955,15 @@ discard block |
||
| 955 | 955 | */ |
| 956 | 956 | public function getStarredProjects() { |
| 957 | 957 | $member = Member::currentUser(); |
| 958 | - if ($member === null) { |
|
| 958 | + if($member === null) { |
|
| 959 | 959 | return new ArrayList(); |
| 960 | 960 | } |
| 961 | 961 | |
| 962 | 962 | $favProjects = $member->StarredProjects(); |
| 963 | 963 | |
| 964 | 964 | $list = new ArrayList(); |
| 965 | - foreach ($favProjects as $project) { |
|
| 966 | - if ($project->canView($member)) { |
|
| 965 | + foreach($favProjects as $project) { |
|
| 966 | + if($project->canView($member)) { |
|
| 967 | 967 | $list->add($project); |
| 968 | 968 | } |
| 969 | 969 | } |
@@ -985,30 +985,30 @@ discard block |
||
| 985 | 985 | $actionType = $this->getCurrentActionType(); |
| 986 | 986 | |
| 987 | 987 | $projects = $this->getStarredProjects(); |
| 988 | - if ($projects->count() < 1) { |
|
| 988 | + if($projects->count() < 1) { |
|
| 989 | 989 | $projects = $this->DNProjectList(); |
| 990 | 990 | } else { |
| 991 | 991 | $limit = -1; |
| 992 | 992 | } |
| 993 | 993 | |
| 994 | - if ($projects->count() > 0) { |
|
| 994 | + if($projects->count() > 0) { |
|
| 995 | 995 | $activeProject = false; |
| 996 | 996 | |
| 997 | - if ($limit > 0) { |
|
| 997 | + if($limit > 0) { |
|
| 998 | 998 | $limitedProjects = $projects->limit($limit); |
| 999 | 999 | } else { |
| 1000 | 1000 | $limitedProjects = $projects; |
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | - foreach ($limitedProjects as $project) { |
|
| 1003 | + foreach($limitedProjects as $project) { |
|
| 1004 | 1004 | $isActive = $currentProject && $currentProject->ID == $project->ID; |
| 1005 | - if ($isActive) { |
|
| 1005 | + if($isActive) { |
|
| 1006 | 1006 | $activeProject = true; |
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | 1009 | $isCurrentEnvironment = false; |
| 1010 | - if ($project && $currentEnvironment) { |
|
| 1011 | - $isCurrentEnvironment = (bool) $project->DNEnvironmentList()->find('ID', $currentEnvironment->ID); |
|
| 1010 | + if($project && $currentEnvironment) { |
|
| 1011 | + $isCurrentEnvironment = (bool)$project->DNEnvironmentList()->find('ID', $currentEnvironment->ID); |
|
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | $navigation->push([ |
@@ -1020,14 +1020,14 @@ discard block |
||
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | // Ensure the current project is in the list |
| 1023 | - if (!$activeProject && $currentProject) { |
|
| 1023 | + if(!$activeProject && $currentProject) { |
|
| 1024 | 1024 | $navigation->unshift([ |
| 1025 | 1025 | 'Project' => $currentProject, |
| 1026 | 1026 | 'IsActive' => true, |
| 1027 | 1027 | 'IsCurrentEnvironment' => $currentEnvironment, |
| 1028 | 1028 | 'IsOverview' => $actionType == self::PROJECT_OVERVIEW |
| 1029 | 1029 | ]); |
| 1030 | - if ($limit > 0 && $navigation->count() > $limit) { |
|
| 1030 | + if($limit > 0 && $navigation->count() > $limit) { |
|
| 1031 | 1031 | $navigation->pop(); |
| 1032 | 1032 | } |
| 1033 | 1033 | } |
@@ -1047,17 +1047,17 @@ discard block |
||
| 1047 | 1047 | |
| 1048 | 1048 | // Performs canView permission check by limiting visible projects |
| 1049 | 1049 | $project = $this->getCurrentProject(); |
| 1050 | - if (!$project) { |
|
| 1050 | + if(!$project) { |
|
| 1051 | 1051 | return $this->project404Response(); |
| 1052 | 1052 | } |
| 1053 | 1053 | |
| 1054 | 1054 | // Performs canView permission check by limiting visible projects |
| 1055 | 1055 | $environment = $this->getCurrentEnvironment($project); |
| 1056 | - if (!$environment) { |
|
| 1056 | + if(!$environment) { |
|
| 1057 | 1057 | return $this->environment404Response(); |
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | - if (!$environment->canDeploy()) { |
|
| 1060 | + if(!$environment->canDeploy()) { |
|
| 1061 | 1061 | return new SS_HTTPResponse("Not allowed to deploy", 401); |
| 1062 | 1062 | } |
| 1063 | 1063 | |
@@ -1065,7 +1065,7 @@ discard block |
||
| 1065 | 1065 | $form = new DeployForm($this, 'DeployForm', $environment, $project); |
| 1066 | 1066 | |
| 1067 | 1067 | // If this is an ajax request we don't want to submit the form - we just want to retrieve the markup. |
| 1068 | - if ( |
|
| 1068 | + if( |
|
| 1069 | 1069 | $request && |
| 1070 | 1070 | !$request->requestVar('action_showDeploySummary') && |
| 1071 | 1071 | $this->getRequest()->isAjax() && |
@@ -1080,7 +1080,7 @@ discard block |
||
| 1080 | 1080 | return $body; |
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | - $form->setFormAction($this->getRequest()->getURL() . '/DeployForm'); |
|
| 1083 | + $form->setFormAction($this->getRequest()->getURL().'/DeployForm'); |
|
| 1084 | 1084 | return $form; |
| 1085 | 1085 | } |
| 1086 | 1086 | |
@@ -1095,18 +1095,18 @@ discard block |
||
| 1095 | 1095 | |
| 1096 | 1096 | // Performs canView permission check by limiting visible projects |
| 1097 | 1097 | $project = $this->getCurrentProject(); |
| 1098 | - if (!$project) { |
|
| 1098 | + if(!$project) { |
|
| 1099 | 1099 | return $this->project404Response(); |
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | // Performs canView permission check by limiting visible projects |
| 1103 | 1103 | $env = $this->getCurrentEnvironment($project); |
| 1104 | - if (!$env) { |
|
| 1104 | + if(!$env) { |
|
| 1105 | 1105 | return $this->environment404Response(); |
| 1106 | 1106 | } |
| 1107 | 1107 | |
| 1108 | 1108 | $options = []; |
| 1109 | - foreach ($env->Backend()->getDeployOptions($env) as $option) { |
|
| 1109 | + foreach($env->Backend()->getDeployOptions($env) as $option) { |
|
| 1110 | 1110 | $options[] = [ |
| 1111 | 1111 | 'name' => $option->getName(), |
| 1112 | 1112 | 'title' => $option->getTitle(), |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | 'field_data' => [], |
| 1126 | 1126 | 'options' => $options |
| 1127 | 1127 | ]; |
| 1128 | - foreach ($project->DNBranchList() as $branch) { |
|
| 1128 | + foreach($project->DNBranchList() as $branch) { |
|
| 1129 | 1129 | $sha = $branch->SHA(); |
| 1130 | 1130 | $name = $branch->Name(); |
| 1131 | 1131 | $branchValue = sprintf("%s (%s, %s old)", |
@@ -1151,7 +1151,7 @@ discard block |
||
| 1151 | 1151 | 'options' => $options |
| 1152 | 1152 | ]; |
| 1153 | 1153 | |
| 1154 | - foreach ($project->DNTagList()->setLimit(null) as $tag) { |
|
| 1154 | + foreach($project->DNTagList()->setLimit(null) as $tag) { |
|
| 1155 | 1155 | $name = $tag->Name(); |
| 1156 | 1156 | $data['field_data'][] = [ |
| 1157 | 1157 | 'id' => $tag->SHA(), |
@@ -1177,15 +1177,15 @@ discard block |
||
| 1177 | 1177 | // We are aiming at the format: |
| 1178 | 1178 | // [{text: 'optgroup text', children: [{id: '<sha>', text: '<inner text>'}]}] |
| 1179 | 1179 | $redeploy = []; |
| 1180 | - foreach ($project->DNEnvironmentList() as $dnEnvironment) { |
|
| 1180 | + foreach($project->DNEnvironmentList() as $dnEnvironment) { |
|
| 1181 | 1181 | $envName = $dnEnvironment->Name; |
| 1182 | 1182 | $perEnvDeploys = []; |
| 1183 | 1183 | |
| 1184 | - foreach ($dnEnvironment->DeployHistory() as $deploy) { |
|
| 1184 | + foreach($dnEnvironment->DeployHistory() as $deploy) { |
|
| 1185 | 1185 | $sha = $deploy->SHA; |
| 1186 | 1186 | |
| 1187 | 1187 | // Check if exists to make sure the newest deployment date is used. |
| 1188 | - if (!isset($perEnvDeploys[$sha])) { |
|
| 1188 | + if(!isset($perEnvDeploys[$sha])) { |
|
| 1189 | 1189 | $pastValue = sprintf("%s (deployed %s)", |
| 1190 | 1190 | substr($sha, 0, 8), |
| 1191 | 1191 | $deploy->obj('LastEdited')->Ago() |
@@ -1197,12 +1197,12 @@ discard block |
||
| 1197 | 1197 | } |
| 1198 | 1198 | } |
| 1199 | 1199 | |
| 1200 | - if (!empty($perEnvDeploys)) { |
|
| 1200 | + if(!empty($perEnvDeploys)) { |
|
| 1201 | 1201 | $redeploy[$envName] = array_values($perEnvDeploys); |
| 1202 | 1202 | } |
| 1203 | 1203 | } |
| 1204 | 1204 | // Convert the array to the frontend format (i.e. keyed to regular array) |
| 1205 | - foreach ($redeploy as $name => $descr) { |
|
| 1205 | + foreach($redeploy as $name => $descr) { |
|
| 1206 | 1206 | $data['field_data'][] = ['text' => $name, 'children' => $descr]; |
| 1207 | 1207 | } |
| 1208 | 1208 | $tabs[] = $data; |
@@ -1224,7 +1224,7 @@ discard block |
||
| 1224 | 1224 | ->filter('ProjectID', $project->ID) |
| 1225 | 1225 | ->sort('LastEdited', 'DESC') |
| 1226 | 1226 | ->first(); |
| 1227 | - if ($fetch) { |
|
| 1227 | + if($fetch) { |
|
| 1228 | 1228 | $lastFetched = $fetch->dbObject('LastEdited')->Ago(); |
| 1229 | 1229 | } |
| 1230 | 1230 | |
@@ -1249,13 +1249,13 @@ discard block |
||
| 1249 | 1249 | |
| 1250 | 1250 | // Performs canView permission check by limiting visible projects |
| 1251 | 1251 | $project = $this->getCurrentProject(); |
| 1252 | - if (!$project) { |
|
| 1252 | + if(!$project) { |
|
| 1253 | 1253 | return $this->project404Response(); |
| 1254 | 1254 | } |
| 1255 | 1255 | |
| 1256 | 1256 | // Performs canView permission check by limiting visible projects |
| 1257 | 1257 | $environment = $this->getCurrentEnvironment($project); |
| 1258 | - if (!$environment) { |
|
| 1258 | + if(!$environment) { |
|
| 1259 | 1259 | return $this->environment404Response(); |
| 1260 | 1260 | } |
| 1261 | 1261 | |
@@ -1266,7 +1266,7 @@ discard block |
||
| 1266 | 1266 | // Add in a URL for comparing from->to code changes. Ensure that we have |
| 1267 | 1267 | // two proper 40 character SHAs, otherwise we can't show the compare link. |
| 1268 | 1268 | $interface = $project->getRepositoryInterface(); |
| 1269 | - if ( |
|
| 1269 | + if( |
|
| 1270 | 1270 | !empty($interface) && !empty($interface->URL) |
| 1271 | 1271 | && !empty($data['changes']['Code version']['from']) |
| 1272 | 1272 | && strlen($data['changes']['Code version']['from']) == '40' |
@@ -1310,26 +1310,26 @@ discard block |
||
| 1310 | 1310 | |
| 1311 | 1311 | // Ensure the submitted token has a value |
| 1312 | 1312 | $submittedToken = $request->postVar(\Dispatcher::SECURITY_TOKEN_NAME); |
| 1313 | - if (!$submittedToken) { |
|
| 1313 | + if(!$submittedToken) { |
|
| 1314 | 1314 | return false; |
| 1315 | 1315 | } |
| 1316 | 1316 | // Do the actual check. |
| 1317 | 1317 | $check = $token->check($submittedToken); |
| 1318 | 1318 | // Ensure the CSRF Token is correct |
| 1319 | - if (!$check) { |
|
| 1319 | + if(!$check) { |
|
| 1320 | 1320 | // CSRF token didn't match |
| 1321 | 1321 | return $this->httpError(400, 'Bad Request'); |
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | 1324 | // Performs canView permission check by limiting visible projects |
| 1325 | 1325 | $project = $this->getCurrentProject(); |
| 1326 | - if (!$project) { |
|
| 1326 | + if(!$project) { |
|
| 1327 | 1327 | return $this->project404Response(); |
| 1328 | 1328 | } |
| 1329 | 1329 | |
| 1330 | 1330 | // Performs canView permission check by limiting visible projects |
| 1331 | 1331 | $environment = $this->getCurrentEnvironment($project); |
| 1332 | - if (!$environment) { |
|
| 1332 | + if(!$environment) { |
|
| 1333 | 1333 | return $this->environment404Response(); |
| 1334 | 1334 | } |
| 1335 | 1335 | |
@@ -1346,7 +1346,7 @@ discard block |
||
| 1346 | 1346 | $deployment->getMachine()->apply(DNDeployment::TR_QUEUE); |
| 1347 | 1347 | |
| 1348 | 1348 | return json_encode([ |
| 1349 | - 'url' => Director::absoluteBaseURL() . $deployment->Link() |
|
| 1349 | + 'url' => Director::absoluteBaseURL().$deployment->Link() |
|
| 1350 | 1350 | ], JSON_PRETTY_PRINT); |
| 1351 | 1351 | } |
| 1352 | 1352 | |
@@ -1364,20 +1364,20 @@ discard block |
||
| 1364 | 1364 | $params = $request->params(); |
| 1365 | 1365 | $deployment = DNDeployment::get()->byId($params['Identifier']); |
| 1366 | 1366 | |
| 1367 | - if (!$deployment || !$deployment->ID) { |
|
| 1367 | + if(!$deployment || !$deployment->ID) { |
|
| 1368 | 1368 | throw new SS_HTTPResponse_Exception('Deployment not found', 404); |
| 1369 | 1369 | } |
| 1370 | - if (!$deployment->canView()) { |
|
| 1370 | + if(!$deployment->canView()) { |
|
| 1371 | 1371 | return Security::permissionFailure(); |
| 1372 | 1372 | } |
| 1373 | 1373 | |
| 1374 | 1374 | $environment = $deployment->Environment(); |
| 1375 | 1375 | $project = $environment->Project(); |
| 1376 | 1376 | |
| 1377 | - if ($environment->Name != $params['Environment']) { |
|
| 1377 | + if($environment->Name != $params['Environment']) { |
|
| 1378 | 1378 | throw new LogicException("Environment in URL doesn't match this deploy"); |
| 1379 | 1379 | } |
| 1380 | - if ($project->Name != $params['Project']) { |
|
| 1380 | + if($project->Name != $params['Project']) { |
|
| 1381 | 1381 | throw new LogicException("Project in URL doesn't match this deploy"); |
| 1382 | 1382 | } |
| 1383 | 1383 | |
@@ -1400,25 +1400,25 @@ discard block |
||
| 1400 | 1400 | $params = $request->params(); |
| 1401 | 1401 | $deployment = DNDeployment::get()->byId($params['Identifier']); |
| 1402 | 1402 | |
| 1403 | - if (!$deployment || !$deployment->ID) { |
|
| 1403 | + if(!$deployment || !$deployment->ID) { |
|
| 1404 | 1404 | throw new SS_HTTPResponse_Exception('Deployment not found', 404); |
| 1405 | 1405 | } |
| 1406 | - if (!$deployment->canView()) { |
|
| 1406 | + if(!$deployment->canView()) { |
|
| 1407 | 1407 | return Security::permissionFailure(); |
| 1408 | 1408 | } |
| 1409 | 1409 | |
| 1410 | 1410 | $environment = $deployment->Environment(); |
| 1411 | 1411 | $project = $environment->Project(); |
| 1412 | 1412 | |
| 1413 | - if ($environment->Name != $params['Environment']) { |
|
| 1413 | + if($environment->Name != $params['Environment']) { |
|
| 1414 | 1414 | throw new LogicException("Environment in URL doesn't match this deploy"); |
| 1415 | 1415 | } |
| 1416 | - if ($project->Name != $params['Project']) { |
|
| 1416 | + if($project->Name != $params['Project']) { |
|
| 1417 | 1417 | throw new LogicException("Project in URL doesn't match this deploy"); |
| 1418 | 1418 | } |
| 1419 | 1419 | |
| 1420 | 1420 | $log = $deployment->log(); |
| 1421 | - if ($log->exists()) { |
|
| 1421 | + if($log->exists()) { |
|
| 1422 | 1422 | $content = $log->content(); |
| 1423 | 1423 | } else { |
| 1424 | 1424 | $content = 'Waiting for action to start'; |
@@ -1431,29 +1431,29 @@ discard block |
||
| 1431 | 1431 | $params = $request->params(); |
| 1432 | 1432 | $deployment = DNDeployment::get()->byId($params['Identifier']); |
| 1433 | 1433 | |
| 1434 | - if (!$deployment || !$deployment->ID) { |
|
| 1434 | + if(!$deployment || !$deployment->ID) { |
|
| 1435 | 1435 | throw new SS_HTTPResponse_Exception('Deployment not found', 404); |
| 1436 | 1436 | } |
| 1437 | - if (!$deployment->canView()) { |
|
| 1437 | + if(!$deployment->canView()) { |
|
| 1438 | 1438 | return Security::permissionFailure(); |
| 1439 | 1439 | } |
| 1440 | 1440 | |
| 1441 | 1441 | // For now restrict to ADMINs only. |
| 1442 | - if (!Permission::check('ADMIN')) { |
|
| 1442 | + if(!Permission::check('ADMIN')) { |
|
| 1443 | 1443 | return Security::permissionFailure(); |
| 1444 | 1444 | } |
| 1445 | 1445 | |
| 1446 | 1446 | $environment = $deployment->Environment(); |
| 1447 | 1447 | $project = $environment->Project(); |
| 1448 | 1448 | |
| 1449 | - if ($environment->Name != $params['Environment']) { |
|
| 1449 | + if($environment->Name != $params['Environment']) { |
|
| 1450 | 1450 | throw new LogicException("Environment in URL doesn't match this deploy"); |
| 1451 | 1451 | } |
| 1452 | - if ($project->Name != $params['Project']) { |
|
| 1452 | + if($project->Name != $params['Project']) { |
|
| 1453 | 1453 | throw new LogicException("Project in URL doesn't match this deploy"); |
| 1454 | 1454 | } |
| 1455 | 1455 | |
| 1456 | - if (!in_array($deployment->Status, ['Queued', 'Deploying', 'Aborting'])) { |
|
| 1456 | + if(!in_array($deployment->Status, ['Queued', 'Deploying', 'Aborting'])) { |
|
| 1457 | 1457 | throw new LogicException(sprintf("Cannot abort from %s state.", $deployment->Status)); |
| 1458 | 1458 | } |
| 1459 | 1459 | |
@@ -1469,11 +1469,11 @@ discard block |
||
| 1469 | 1469 | */ |
| 1470 | 1470 | public function getDataTransferForm(SS_HTTPRequest $request = null) { |
| 1471 | 1471 | // Performs canView permission check by limiting visible projects |
| 1472 | - $envs = $this->getCurrentProject()->DNEnvironmentList()->filterByCallback(function ($item) { |
|
| 1472 | + $envs = $this->getCurrentProject()->DNEnvironmentList()->filterByCallback(function($item) { |
|
| 1473 | 1473 | return $item->canBackup(); |
| 1474 | 1474 | }); |
| 1475 | 1475 | |
| 1476 | - if (!$envs) { |
|
| 1476 | + if(!$envs) { |
|
| 1477 | 1477 | return $this->environment404Response(); |
| 1478 | 1478 | } |
| 1479 | 1479 | |
@@ -1491,7 +1491,7 @@ discard block |
||
| 1491 | 1491 | ->addExtraClass('btn') |
| 1492 | 1492 | ) |
| 1493 | 1493 | ); |
| 1494 | - $form->setFormAction($this->getRequest()->getURL() . '/DataTransferForm'); |
|
| 1494 | + $form->setFormAction($this->getRequest()->getURL().'/DataTransferForm'); |
|
| 1495 | 1495 | |
| 1496 | 1496 | return $form; |
| 1497 | 1497 | } |
@@ -1508,21 +1508,21 @@ discard block |
||
| 1508 | 1508 | |
| 1509 | 1509 | // Performs canView permission check by limiting visible projects |
| 1510 | 1510 | $project = $this->getCurrentProject(); |
| 1511 | - if (!$project) { |
|
| 1511 | + if(!$project) { |
|
| 1512 | 1512 | return $this->project404Response(); |
| 1513 | 1513 | } |
| 1514 | 1514 | |
| 1515 | 1515 | $dataArchive = null; |
| 1516 | 1516 | |
| 1517 | 1517 | // Validate direction. |
| 1518 | - if ($data['Direction'] == 'get') { |
|
| 1518 | + if($data['Direction'] == 'get') { |
|
| 1519 | 1519 | $validEnvs = $this->getCurrentProject()->DNEnvironmentList() |
| 1520 | - ->filterByCallback(function ($item) { |
|
| 1520 | + ->filterByCallback(function($item) { |
|
| 1521 | 1521 | return $item->canBackup(); |
| 1522 | 1522 | }); |
| 1523 | - } else if ($data['Direction'] == 'push') { |
|
| 1523 | + } else if($data['Direction'] == 'push') { |
|
| 1524 | 1524 | $validEnvs = $this->getCurrentProject()->DNEnvironmentList() |
| 1525 | - ->filterByCallback(function ($item) { |
|
| 1525 | + ->filterByCallback(function($item) { |
|
| 1526 | 1526 | return $item->canRestore(); |
| 1527 | 1527 | }); |
| 1528 | 1528 | } else { |
@@ -1531,24 +1531,24 @@ discard block |
||
| 1531 | 1531 | |
| 1532 | 1532 | // Validate $data['EnvironmentID'] by checking against $validEnvs. |
| 1533 | 1533 | $environment = $validEnvs->find('ID', $data['EnvironmentID']); |
| 1534 | - if (!$environment) { |
|
| 1534 | + if(!$environment) { |
|
| 1535 | 1535 | throw new LogicException('Invalid environment'); |
| 1536 | 1536 | } |
| 1537 | 1537 | |
| 1538 | 1538 | $this->validateSnapshotMode($data['Mode']); |
| 1539 | 1539 | |
| 1540 | 1540 | // Only 'push' direction is allowed an association with an existing archive. |
| 1541 | - if ( |
|
| 1541 | + if( |
|
| 1542 | 1542 | $data['Direction'] == 'push' |
| 1543 | 1543 | && isset($data['DataArchiveID']) |
| 1544 | 1544 | && is_numeric($data['DataArchiveID']) |
| 1545 | 1545 | ) { |
| 1546 | 1546 | $dataArchive = DNDataArchive::get()->byId($data['DataArchiveID']); |
| 1547 | - if (!$dataArchive) { |
|
| 1547 | + if(!$dataArchive) { |
|
| 1548 | 1548 | throw new LogicException('Invalid data archive'); |
| 1549 | 1549 | } |
| 1550 | 1550 | |
| 1551 | - if (!$dataArchive->canDownload()) { |
|
| 1551 | + if(!$dataArchive->canDownload()) { |
|
| 1552 | 1552 | throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1553 | 1553 | } |
| 1554 | 1554 | } |
@@ -1558,7 +1558,7 @@ discard block |
||
| 1558 | 1558 | $transfer->Direction = $data['Direction']; |
| 1559 | 1559 | $transfer->Mode = $data['Mode']; |
| 1560 | 1560 | $transfer->DataArchiveID = $dataArchive ? $dataArchive->ID : null; |
| 1561 | - if ($data['Direction'] == 'push') { |
|
| 1561 | + if($data['Direction'] == 'push') { |
|
| 1562 | 1562 | $transfer->setBackupBeforePush(!empty($data['BackupBeforePush'])); |
| 1563 | 1563 | } |
| 1564 | 1564 | $transfer->write(); |
@@ -1581,17 +1581,17 @@ discard block |
||
| 1581 | 1581 | $params = $request->params(); |
| 1582 | 1582 | $transfer = DNDataTransfer::get()->byId($params['Identifier']); |
| 1583 | 1583 | |
| 1584 | - if (!$transfer || !$transfer->ID) { |
|
| 1584 | + if(!$transfer || !$transfer->ID) { |
|
| 1585 | 1585 | throw new SS_HTTPResponse_Exception('Transfer not found', 404); |
| 1586 | 1586 | } |
| 1587 | - if (!$transfer->canView()) { |
|
| 1587 | + if(!$transfer->canView()) { |
|
| 1588 | 1588 | return Security::permissionFailure(); |
| 1589 | 1589 | } |
| 1590 | 1590 | |
| 1591 | 1591 | $environment = $transfer->Environment(); |
| 1592 | 1592 | $project = $environment->Project(); |
| 1593 | 1593 | |
| 1594 | - if ($project->Name != $params['Project']) { |
|
| 1594 | + if($project->Name != $params['Project']) { |
|
| 1595 | 1595 | throw new LogicException("Project in URL doesn't match this deploy"); |
| 1596 | 1596 | } |
| 1597 | 1597 | |
@@ -1615,22 +1615,22 @@ discard block |
||
| 1615 | 1615 | $params = $request->params(); |
| 1616 | 1616 | $transfer = DNDataTransfer::get()->byId($params['Identifier']); |
| 1617 | 1617 | |
| 1618 | - if (!$transfer || !$transfer->ID) { |
|
| 1618 | + if(!$transfer || !$transfer->ID) { |
|
| 1619 | 1619 | throw new SS_HTTPResponse_Exception('Transfer not found', 404); |
| 1620 | 1620 | } |
| 1621 | - if (!$transfer->canView()) { |
|
| 1621 | + if(!$transfer->canView()) { |
|
| 1622 | 1622 | return Security::permissionFailure(); |
| 1623 | 1623 | } |
| 1624 | 1624 | |
| 1625 | 1625 | $environment = $transfer->Environment(); |
| 1626 | 1626 | $project = $environment->Project(); |
| 1627 | 1627 | |
| 1628 | - if ($project->Name != $params['Project']) { |
|
| 1628 | + if($project->Name != $params['Project']) { |
|
| 1629 | 1629 | throw new LogicException("Project in URL doesn't match this deploy"); |
| 1630 | 1630 | } |
| 1631 | 1631 | |
| 1632 | 1632 | $log = $transfer->log(); |
| 1633 | - if ($log->exists()) { |
|
| 1633 | + if($log->exists()) { |
|
| 1634 | 1634 | $content = $log->content(); |
| 1635 | 1635 | } else { |
| 1636 | 1636 | $content = 'Waiting for action to start'; |
@@ -1653,22 +1653,22 @@ discard block |
||
| 1653 | 1653 | |
| 1654 | 1654 | // Performs canView permission check by limiting visible projects |
| 1655 | 1655 | $project = $this->getCurrentProject(); |
| 1656 | - $envs = $project->DNEnvironmentList()->filterByCallback(function ($item) { |
|
| 1656 | + $envs = $project->DNEnvironmentList()->filterByCallback(function($item) { |
|
| 1657 | 1657 | return $item->canRestore(); |
| 1658 | 1658 | }); |
| 1659 | 1659 | |
| 1660 | - if (!$envs) { |
|
| 1660 | + if(!$envs) { |
|
| 1661 | 1661 | return $this->environment404Response(); |
| 1662 | 1662 | } |
| 1663 | 1663 | |
| 1664 | 1664 | $modesMap = []; |
| 1665 | - if (in_array($dataArchive->Mode, ['all'])) { |
|
| 1665 | + if(in_array($dataArchive->Mode, ['all'])) { |
|
| 1666 | 1666 | $modesMap['all'] = 'Database and Assets'; |
| 1667 | 1667 | }; |
| 1668 | - if (in_array($dataArchive->Mode, ['all', 'db'])) { |
|
| 1668 | + if(in_array($dataArchive->Mode, ['all', 'db'])) { |
|
| 1669 | 1669 | $modesMap['db'] = 'Database only'; |
| 1670 | 1670 | }; |
| 1671 | - if (in_array($dataArchive->Mode, ['all', 'assets'])) { |
|
| 1671 | + if(in_array($dataArchive->Mode, ['all', 'assets'])) { |
|
| 1672 | 1672 | $modesMap['assets'] = 'Assets only'; |
| 1673 | 1673 | }; |
| 1674 | 1674 | |
@@ -1692,7 +1692,7 @@ discard block |
||
| 1692 | 1692 | ->addExtraClass('btn') |
| 1693 | 1693 | ) |
| 1694 | 1694 | ); |
| 1695 | - $form->setFormAction($project->Link() . '/DataTransferRestoreForm'); |
|
| 1695 | + $form->setFormAction($project->Link().'/DataTransferRestoreForm'); |
|
| 1696 | 1696 | |
| 1697 | 1697 | return $form; |
| 1698 | 1698 | } |
@@ -1713,13 +1713,13 @@ discard block |
||
| 1713 | 1713 | /** @var DNDataArchive $dataArchive */ |
| 1714 | 1714 | $dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1715 | 1715 | |
| 1716 | - if (!$dataArchive) { |
|
| 1716 | + if(!$dataArchive) { |
|
| 1717 | 1717 | throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1718 | 1718 | } |
| 1719 | 1719 | |
| 1720 | 1720 | // We check for canDownload because that implies access to the data. |
| 1721 | 1721 | // canRestore is later checked on the actual restore action per environment. |
| 1722 | - if (!$dataArchive->canDownload()) { |
|
| 1722 | + if(!$dataArchive->canDownload()) { |
|
| 1723 | 1723 | throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1724 | 1724 | } |
| 1725 | 1725 | |
@@ -1745,11 +1745,11 @@ discard block |
||
| 1745 | 1745 | /** @var DNDataArchive $dataArchive */ |
| 1746 | 1746 | $dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1747 | 1747 | |
| 1748 | - if (!$dataArchive) { |
|
| 1748 | + if(!$dataArchive) { |
|
| 1749 | 1749 | throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1750 | 1750 | } |
| 1751 | 1751 | |
| 1752 | - if (!$dataArchive->canDelete()) { |
|
| 1752 | + if(!$dataArchive->canDelete()) { |
|
| 1753 | 1753 | throw new SS_HTTPResponse_Exception('Not allowed to delete archive', 403); |
| 1754 | 1754 | } |
| 1755 | 1755 | |
@@ -1770,7 +1770,7 @@ discard block |
||
| 1770 | 1770 | |
| 1771 | 1771 | // Performs canView permission check by limiting visible projects |
| 1772 | 1772 | $project = $this->getCurrentProject(); |
| 1773 | - if (!$project) { |
|
| 1773 | + if(!$project) { |
|
| 1774 | 1774 | return $this->project404Response(); |
| 1775 | 1775 | } |
| 1776 | 1776 | |
@@ -1790,7 +1790,7 @@ discard block |
||
| 1790 | 1790 | ->addExtraClass('btn') |
| 1791 | 1791 | ) |
| 1792 | 1792 | ); |
| 1793 | - $form->setFormAction($project->Link() . '/DeleteForm'); |
|
| 1793 | + $form->setFormAction($project->Link().'/DeleteForm'); |
|
| 1794 | 1794 | |
| 1795 | 1795 | return $form; |
| 1796 | 1796 | } |
@@ -1807,24 +1807,24 @@ discard block |
||
| 1807 | 1807 | |
| 1808 | 1808 | // Performs canView permission check by limiting visible projects |
| 1809 | 1809 | $project = $this->getCurrentProject(); |
| 1810 | - if (!$project) { |
|
| 1810 | + if(!$project) { |
|
| 1811 | 1811 | return $this->project404Response(); |
| 1812 | 1812 | } |
| 1813 | 1813 | |
| 1814 | 1814 | $dataArchive = null; |
| 1815 | 1815 | |
| 1816 | - if ( |
|
| 1816 | + if( |
|
| 1817 | 1817 | isset($data['DataArchiveID']) |
| 1818 | 1818 | && is_numeric($data['DataArchiveID']) |
| 1819 | 1819 | ) { |
| 1820 | 1820 | $dataArchive = DNDataArchive::get()->byId($data['DataArchiveID']); |
| 1821 | 1821 | } |
| 1822 | 1822 | |
| 1823 | - if (!$dataArchive) { |
|
| 1823 | + if(!$dataArchive) { |
|
| 1824 | 1824 | throw new LogicException('Invalid data archive'); |
| 1825 | 1825 | } |
| 1826 | 1826 | |
| 1827 | - if (!$dataArchive->canDelete()) { |
|
| 1827 | + if(!$dataArchive->canDelete()) { |
|
| 1828 | 1828 | throw new SS_HTTPResponse_Exception('Not allowed to delete archive', 403); |
| 1829 | 1829 | } |
| 1830 | 1830 | |
@@ -1847,12 +1847,12 @@ discard block |
||
| 1847 | 1847 | /** @var DNDataArchive $dataArchive */ |
| 1848 | 1848 | $dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1849 | 1849 | |
| 1850 | - if (!$dataArchive) { |
|
| 1850 | + if(!$dataArchive) { |
|
| 1851 | 1851 | throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1852 | 1852 | } |
| 1853 | 1853 | |
| 1854 | 1854 | // We check for canDownload because that implies access to the data. |
| 1855 | - if (!$dataArchive->canDownload()) { |
|
| 1855 | + if(!$dataArchive->canDownload()) { |
|
| 1856 | 1856 | throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1857 | 1857 | } |
| 1858 | 1858 | |
@@ -1874,7 +1874,7 @@ discard block |
||
| 1874 | 1874 | $dataArchive = $dataArchive ? $dataArchive : DNDataArchive::get()->byId($request->requestVar('DataArchiveID')); |
| 1875 | 1875 | |
| 1876 | 1876 | $envs = $dataArchive->validTargetEnvironments(); |
| 1877 | - if (!$envs) { |
|
| 1877 | + if(!$envs) { |
|
| 1878 | 1878 | return $this->environment404Response(); |
| 1879 | 1879 | } |
| 1880 | 1880 | |
@@ -1896,7 +1896,7 @@ discard block |
||
| 1896 | 1896 | ->addExtraClass('btn') |
| 1897 | 1897 | ) |
| 1898 | 1898 | ); |
| 1899 | - $form->setFormAction($this->getCurrentProject()->Link() . '/MoveForm'); |
|
| 1899 | + $form->setFormAction($this->getCurrentProject()->Link().'/MoveForm'); |
|
| 1900 | 1900 | |
| 1901 | 1901 | return $form; |
| 1902 | 1902 | } |
@@ -1915,25 +1915,25 @@ discard block |
||
| 1915 | 1915 | |
| 1916 | 1916 | // Performs canView permission check by limiting visible projects |
| 1917 | 1917 | $project = $this->getCurrentProject(); |
| 1918 | - if (!$project) { |
|
| 1918 | + if(!$project) { |
|
| 1919 | 1919 | return $this->project404Response(); |
| 1920 | 1920 | } |
| 1921 | 1921 | |
| 1922 | 1922 | /** @var DNDataArchive $dataArchive */ |
| 1923 | 1923 | $dataArchive = DNDataArchive::get()->byId($data['DataArchiveID']); |
| 1924 | - if (!$dataArchive) { |
|
| 1924 | + if(!$dataArchive) { |
|
| 1925 | 1925 | throw new LogicException('Invalid data archive'); |
| 1926 | 1926 | } |
| 1927 | 1927 | |
| 1928 | 1928 | // We check for canDownload because that implies access to the data. |
| 1929 | - if (!$dataArchive->canDownload()) { |
|
| 1929 | + if(!$dataArchive->canDownload()) { |
|
| 1930 | 1930 | throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1931 | 1931 | } |
| 1932 | 1932 | |
| 1933 | 1933 | // Validate $data['EnvironmentID'] by checking against $validEnvs. |
| 1934 | 1934 | $validEnvs = $dataArchive->validTargetEnvironments(); |
| 1935 | 1935 | $environment = $validEnvs->find('ID', $data['EnvironmentID']); |
| 1936 | - if (!$environment) { |
|
| 1936 | + if(!$environment) { |
|
| 1937 | 1937 | throw new LogicException('Invalid environment'); |
| 1938 | 1938 | } |
| 1939 | 1939 | |
@@ -1951,7 +1951,7 @@ discard block |
||
| 1951 | 1951 | public static function RedisUnavailable() { |
| 1952 | 1952 | try { |
| 1953 | 1953 | Resque::queues(); |
| 1954 | - } catch (Exception $e) { |
|
| 1954 | + } catch(Exception $e) { |
|
| 1955 | 1955 | return $e->getMessage(); |
| 1956 | 1956 | } |
| 1957 | 1957 | return ''; |
@@ -2005,10 +2005,10 @@ discard block |
||
| 2005 | 2005 | */ |
| 2006 | 2006 | public function getCurrentProject() { |
| 2007 | 2007 | $projectName = trim($this->getRequest()->param('Project')); |
| 2008 | - if (!$projectName) { |
|
| 2008 | + if(!$projectName) { |
|
| 2009 | 2009 | return null; |
| 2010 | 2010 | } |
| 2011 | - if (empty(self::$_project_cache[$projectName])) { |
|
| 2011 | + if(empty(self::$_project_cache[$projectName])) { |
|
| 2012 | 2012 | self::$_project_cache[$projectName] = $this->DNProjectList()->filter('Name', $projectName)->First(); |
| 2013 | 2013 | } |
| 2014 | 2014 | return self::$_project_cache[$projectName]; |
@@ -2019,14 +2019,14 @@ discard block |
||
| 2019 | 2019 | * @return DNEnvironment|null |
| 2020 | 2020 | */ |
| 2021 | 2021 | public function getCurrentEnvironment(DNProject $project = null) { |
| 2022 | - if ($this->getRequest()->param('Environment') === null) { |
|
| 2022 | + if($this->getRequest()->param('Environment') === null) { |
|
| 2023 | 2023 | return null; |
| 2024 | 2024 | } |
| 2025 | - if ($project === null) { |
|
| 2025 | + if($project === null) { |
|
| 2026 | 2026 | $project = $this->getCurrentProject(); |
| 2027 | 2027 | } |
| 2028 | 2028 | // project can still be null |
| 2029 | - if ($project === null) { |
|
| 2029 | + if($project === null) { |
|
| 2030 | 2030 | return null; |
| 2031 | 2031 | } |
| 2032 | 2032 | return $project->DNEnvironmentList()->filter('Name', $this->getRequest()->param('Environment'))->First(); |
@@ -2065,23 +2065,23 @@ discard block |
||
| 2065 | 2065 | * @return boolean|null true if $member has access to upload or download to at least one {@link DNEnvironment}. |
| 2066 | 2066 | */ |
| 2067 | 2067 | public function CanViewArchives(Member $member = null) { |
| 2068 | - if ($member === null) { |
|
| 2068 | + if($member === null) { |
|
| 2069 | 2069 | $member = Member::currentUser(); |
| 2070 | 2070 | } |
| 2071 | 2071 | |
| 2072 | - if (Permission::checkMember($member, 'ADMIN')) { |
|
| 2072 | + if(Permission::checkMember($member, 'ADMIN')) { |
|
| 2073 | 2073 | return true; |
| 2074 | 2074 | } |
| 2075 | 2075 | |
| 2076 | 2076 | $allProjects = $this->DNProjectList(); |
| 2077 | - if (!$allProjects) { |
|
| 2077 | + if(!$allProjects) { |
|
| 2078 | 2078 | return false; |
| 2079 | 2079 | } |
| 2080 | 2080 | |
| 2081 | - foreach ($allProjects as $project) { |
|
| 2082 | - if ($project->Environments()) { |
|
| 2083 | - foreach ($project->Environments() as $environment) { |
|
| 2084 | - if ( |
|
| 2081 | + foreach($allProjects as $project) { |
|
| 2082 | + if($project->Environments()) { |
|
| 2083 | + foreach($project->Environments() as $environment) { |
|
| 2084 | + if( |
|
| 2085 | 2085 | $environment->canRestore($member) || |
| 2086 | 2086 | $environment->canBackup($member) || |
| 2087 | 2087 | $environment->canUploadArchive($member) || |
@@ -2102,7 +2102,7 @@ discard block |
||
| 2102 | 2102 | */ |
| 2103 | 2103 | public function CreateEnvironmentList() { |
| 2104 | 2104 | $project = $this->getCurrentProject(); |
| 2105 | - if ($project) { |
|
| 2105 | + if($project) { |
|
| 2106 | 2106 | $dataList = $project->CreateEnvironments(); |
| 2107 | 2107 | } else { |
| 2108 | 2108 | $dataList = new ArrayList(); |
@@ -2122,9 +2122,9 @@ discard block |
||
| 2122 | 2122 | $archives = new ArrayList(); |
| 2123 | 2123 | |
| 2124 | 2124 | $archiveList = $project->Environments()->relation("DataArchives"); |
| 2125 | - if ($archiveList->count() > 0) { |
|
| 2126 | - foreach ($archiveList as $archive) { |
|
| 2127 | - if (!$archive->isPending()) { |
|
| 2125 | + if($archiveList->count() > 0) { |
|
| 2126 | + foreach($archiveList as $archive) { |
|
| 2127 | + if(!$archive->isPending()) { |
|
| 2128 | 2128 | $archives->push($archive); |
| 2129 | 2129 | } |
| 2130 | 2130 | } |
@@ -2139,9 +2139,9 @@ discard block |
||
| 2139 | 2139 | public function PendingDataArchives() { |
| 2140 | 2140 | $project = $this->getCurrentProject(); |
| 2141 | 2141 | $archives = new ArrayList(); |
| 2142 | - foreach ($project->DNEnvironmentList() as $env) { |
|
| 2143 | - foreach ($env->DataArchives() as $archive) { |
|
| 2144 | - if ($archive->isPending()) { |
|
| 2142 | + foreach($project->DNEnvironmentList() as $env) { |
|
| 2143 | + foreach($env->DataArchives() as $archive) { |
|
| 2144 | + if($archive->isPending()) { |
|
| 2145 | 2145 | $archives->push($archive); |
| 2146 | 2146 | } |
| 2147 | 2147 | } |
@@ -2157,7 +2157,7 @@ discard block |
||
| 2157 | 2157 | $transfers = DNDataTransfer::get() |
| 2158 | 2158 | ->filter('EnvironmentID', $environments) |
| 2159 | 2159 | ->filterByCallback( |
| 2160 | - function ($record) { |
|
| 2160 | + function($record) { |
|
| 2161 | 2161 | return |
| 2162 | 2162 | $record->Environment()->canRestore() || // Ensure member can perform an action on the transfers env |
| 2163 | 2163 | $record->Environment()->canBackup() || |
@@ -2174,9 +2174,9 @@ discard block |
||
| 2174 | 2174 | * @return null|PaginatedList |
| 2175 | 2175 | */ |
| 2176 | 2176 | public function DeployHistory() { |
| 2177 | - if ($env = $this->getCurrentEnvironment()) { |
|
| 2177 | + if($env = $this->getCurrentEnvironment()) { |
|
| 2178 | 2178 | $history = $env->DeployHistory(); |
| 2179 | - if ($history->count() > 0) { |
|
| 2179 | + if($history->count() > 0) { |
|
| 2180 | 2180 | $pagination = new PaginatedList($history, $this->getRequest()); |
| 2181 | 2181 | $pagination->setPageLength(4); |
| 2182 | 2182 | return $pagination; |
@@ -2198,7 +2198,7 @@ discard block |
||
| 2198 | 2198 | $sendJSON = (strpos($this->getRequest()->getHeader('Accept'), 'application/json') !== false) |
| 2199 | 2199 | || $this->getRequest()->getExtension() == 'json'; |
| 2200 | 2200 | |
| 2201 | - if (!$sendJSON) { |
|
| 2201 | + if(!$sendJSON) { |
|
| 2202 | 2202 | $this->response->addHeader("Content-type", "text/plain"); |
| 2203 | 2203 | return $content; |
| 2204 | 2204 | } |
@@ -2217,7 +2217,7 @@ discard block |
||
| 2217 | 2217 | public function AmbientMenu() { |
| 2218 | 2218 | $list = new ArrayList(); |
| 2219 | 2219 | |
| 2220 | - if (Member::currentUserID()) { |
|
| 2220 | + if(Member::currentUserID()) { |
|
| 2221 | 2221 | $list->push(new ArrayData([ |
| 2222 | 2222 | 'Classes' => 'logout', |
| 2223 | 2223 | 'FaIcon' => 'sign-out', |
@@ -2238,10 +2238,10 @@ discard block |
||
| 2238 | 2238 | * @return bool |
| 2239 | 2239 | */ |
| 2240 | 2240 | public function canCreateProjects($member = null) { |
| 2241 | - if (!$member) { |
|
| 2241 | + if(!$member) { |
|
| 2242 | 2242 | $member = Member::currentUser(); |
| 2243 | 2243 | } |
| 2244 | - if (!$member) { |
|
| 2244 | + if(!$member) { |
|
| 2245 | 2245 | return false; |
| 2246 | 2246 | } |
| 2247 | 2247 | |
@@ -2249,28 +2249,28 @@ discard block |
||
| 2249 | 2249 | } |
| 2250 | 2250 | |
| 2251 | 2251 | protected function applyRedeploy(SS_HTTPRequest $request, &$data) { |
| 2252 | - if (!$request->getVar('redeploy')) { |
|
| 2252 | + if(!$request->getVar('redeploy')) { |
|
| 2253 | 2253 | return; |
| 2254 | 2254 | } |
| 2255 | 2255 | |
| 2256 | 2256 | $project = $this->getCurrentProject(); |
| 2257 | - if (!$project) { |
|
| 2257 | + if(!$project) { |
|
| 2258 | 2258 | return $this->project404Response(); |
| 2259 | 2259 | } |
| 2260 | 2260 | |
| 2261 | 2261 | // Performs canView permission check by limiting visible projects |
| 2262 | 2262 | $env = $this->getCurrentEnvironment($project); |
| 2263 | - if (!$env) { |
|
| 2263 | + if(!$env) { |
|
| 2264 | 2264 | return $this->environment404Response(); |
| 2265 | 2265 | } |
| 2266 | 2266 | |
| 2267 | 2267 | $current = $env->CurrentBuild(); |
| 2268 | - if ($current && $current->exists()) { |
|
| 2268 | + if($current && $current->exists()) { |
|
| 2269 | 2269 | $data['preselect_tab'] = 3; |
| 2270 | 2270 | $data['preselect_sha'] = $current->SHA; |
| 2271 | 2271 | } else { |
| 2272 | 2272 | $master = $project->DNBranchList()->byName('master'); |
| 2273 | - if ($master) { |
|
| 2273 | + if($master) { |
|
| 2274 | 2274 | $data['preselect_tab'] = 1; |
| 2275 | 2275 | $data['preselect_sha'] = $master->SHA(); |
| 2276 | 2276 | } |
@@ -2282,7 +2282,7 @@ discard block |
||
| 2282 | 2282 | */ |
| 2283 | 2283 | protected function project404Response() { |
| 2284 | 2284 | return new SS_HTTPResponse( |
| 2285 | - "Project '" . Convert::raw2xml($this->getRequest()->param('Project')) . "' not found.", |
|
| 2285 | + "Project '".Convert::raw2xml($this->getRequest()->param('Project'))."' not found.", |
|
| 2286 | 2286 | 404 |
| 2287 | 2287 | ); |
| 2288 | 2288 | } |
@@ -2292,7 +2292,7 @@ discard block |
||
| 2292 | 2292 | */ |
| 2293 | 2293 | protected function environment404Response() { |
| 2294 | 2294 | $envName = Convert::raw2xml($this->getRequest()->param('Environment')); |
| 2295 | - return new SS_HTTPResponse("Environment '" . $envName . "' not found.", 404); |
|
| 2295 | + return new SS_HTTPResponse("Environment '".$envName."' not found.", 404); |
|
| 2296 | 2296 | } |
| 2297 | 2297 | |
| 2298 | 2298 | /** |
@@ -2301,7 +2301,7 @@ discard block |
||
| 2301 | 2301 | * @param string $mode |
| 2302 | 2302 | */ |
| 2303 | 2303 | protected function validateSnapshotMode($mode) { |
| 2304 | - if (!in_array($mode, ['all', 'assets', 'db'])) { |
|
| 2304 | + if(!in_array($mode, ['all', 'assets', 'db'])) { |
|
| 2305 | 2305 | throw new LogicException('Invalid mode'); |
| 2306 | 2306 | } |
| 2307 | 2307 | } |
@@ -2315,12 +2315,12 @@ discard block |
||
| 2315 | 2315 | protected function getCustomisedViewSection($sectionName, $title = '', $data = []) { |
| 2316 | 2316 | // Performs canView permission check by limiting visible projects |
| 2317 | 2317 | $project = $this->getCurrentProject(); |
| 2318 | - if (!$project) { |
|
| 2318 | + if(!$project) { |
|
| 2319 | 2319 | return $this->project404Response(); |
| 2320 | 2320 | } |
| 2321 | 2321 | $data[$sectionName] = 1; |
| 2322 | 2322 | |
| 2323 | - if ($this !== '') { |
|
| 2323 | + if($this !== '') { |
|
| 2324 | 2324 | $data['Title'] = $title; |
| 2325 | 2325 | } |
| 2326 | 2326 | |