@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function LogLink() { |
| 76 | - return $this->Link() . '/log'; |
|
| 76 | + return $this->Link().'/log'; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public function canView($member = null) { |
@@ -205,12 +205,12 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function getFullDeployMessages() { |
| 207 | 207 | $strategy = $this->getDeploymentStrategy(); |
| 208 | - if ($strategy->getActionCode()!=='full') return null; |
|
| 208 | + if($strategy->getActionCode() !== 'full') return null; |
|
| 209 | 209 | |
| 210 | 210 | $changes = $strategy->getChangesModificationNeeded(); |
| 211 | 211 | $messages = []; |
| 212 | - foreach ($changes as $change => $details) { |
|
| 213 | - if ($change==='Code version') continue; |
|
| 212 | + foreach($changes as $change => $details) { |
|
| 213 | + if($change === 'Code version') continue; |
|
| 214 | 214 | |
| 215 | 215 | $messages[] = [ |
| 216 | 216 | 'Flag' => sprintf( |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | ]; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - if (empty($messages)) { |
|
| 224 | + if(empty($messages)) { |
|
| 225 | 225 | $messages[] = [ |
| 226 | 226 | 'Flag' => '', |
| 227 | 227 | 'Text' => '<i>Environment changes have been made.</i>' |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | // if there is a compare URL, and a description or a change (something actually changed) |
| 272 | 272 | // then show the URL. Otherwise don't show anything, as there is no comparison to be made. |
| 273 | - if ($changed || $description) { |
|
| 273 | + if($changed || $description) { |
|
| 274 | 274 | $compareUrl = isset($change['compareUrl']) ? $change['compareUrl'] : ''; |
| 275 | 275 | } |
| 276 | 276 | |
@@ -53,13 +53,13 @@ |
||
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | 55 | public function getFiniteState() { |
| 56 | - return $this->State; |
|
| 57 | - } |
|
| 56 | + return $this->State; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - public function setFiniteState($state) { |
|
| 59 | + public function setFiniteState($state) { |
|
| 60 | 60 | $this->State = $state; |
| 61 | 61 | $this->write(); |
| 62 | - } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | public function getStatus() { |
| 65 | 65 | return $this->State; |
@@ -1,7 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -use Finite\StateMachine\StateMachine; |
|
| 4 | - |
|
| 5 | 3 | class DNDeploymentDispatcher extends Dispatcher { |
| 6 | 4 | |
| 7 | 5 | const ALLOW_DNDEPLOYMENT_APPROVE = 'ALLOW_DNDEPLOYMENT_APPROVE'; |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | // Map authorisation rules to selected transitions. |
| 75 | 75 | $machine->getDispatcher()->addListener( |
| 76 | 76 | 'finite.test_transition', |
| 77 | - function (Finite\Event\TransitionEvent $e) use ($project) { |
|
| 77 | + function(Finite\Event\TransitionEvent $e) use ($project) { |
|
| 78 | 78 | $code = null; |
| 79 | 79 | |
| 80 | - switch ($e->getTransition()->getName()) { |
|
| 80 | + switch($e->getTransition()->getName()) { |
|
| 81 | 81 | case 'approve': |
| 82 | 82 | $code = Dispatcher::ALLOW_DNDEPLOYMENT_APPROVE; |
| 83 | 83 | break; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | break; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if (!$code || !$project->allowed($code)) { |
|
| 89 | + if(!$code || !$project->allowed($code)) { |
|
| 90 | 90 | $e->reject(); |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -76,12 +76,12 @@ |
||
| 76 | 76 | $code = null; |
| 77 | 77 | |
| 78 | 78 | switch ($e->getTransition()->getName()) { |
| 79 | - case 'approve': |
|
| 80 | - $code = self::ALLOW_DNDEPLOYMENT_APPROVE; |
|
| 81 | - break; |
|
| 82 | - case 'queue': |
|
| 83 | - $code = self::ALLOW_DNDEPLOYMENT_QUEUE; |
|
| 84 | - break; |
|
| 79 | + case 'approve': |
|
| 80 | + $code = self::ALLOW_DNDEPLOYMENT_APPROVE; |
|
| 81 | + break; |
|
| 82 | + case 'queue': |
|
| 83 | + $code = self::ALLOW_DNDEPLOYMENT_QUEUE; |
|
| 84 | + break; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | if (!$code || !$project->allowed($code)) { |
@@ -175,8 +175,8 @@ discard block |
||
| 175 | 175 | Requirements::javascript('deploynaut/javascript/material.js'); |
| 176 | 176 | |
| 177 | 177 | // Load the buildable dependencies only if not loaded centrally. |
| 178 | - if (!is_dir(BASE_PATH . DIRECTORY_SEPARATOR . 'static')) { |
|
| 179 | - if (\Director::isDev()) { |
|
| 178 | + if(!is_dir(BASE_PATH.DIRECTORY_SEPARATOR.'static')) { |
|
| 179 | + if(\Director::isDev()) { |
|
| 180 | 180 | \Requirements::javascript('deploynaut/static/bundle-debug.js'); |
| 181 | 181 | } else { |
| 182 | 182 | \Requirements::javascript('deploynaut/static/bundle.js'); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | // Block framework jquery |
| 242 | - Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js'); |
|
| 242 | + Requirements::block(FRAMEWORK_DIR.'/thirdparty/jquery/jquery.js'); |
|
| 243 | 243 | |
| 244 | 244 | self::include_requirements(); |
| 245 | 245 | } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * @return \SS_HTTPResponse |
| 259 | 259 | */ |
| 260 | 260 | public function index(SS_HTTPRequest $request) { |
| 261 | - return $this->redirect($this->Link() . 'projects/'); |
|
| 261 | + return $this->redirect($this->Link().'projects/'); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | /** |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | $form->disableSecurityToken(); |
| 419 | 419 | $form->addExtraClass('fields-wide'); |
| 420 | 420 | // Tweak the action so it plays well with our fake URL structure. |
| 421 | - $form->setFormAction($project->Link() . '/UploadSnapshotForm'); |
|
| 421 | + $form->setFormAction($project->Link().'/UploadSnapshotForm'); |
|
| 422 | 422 | |
| 423 | 423 | return $form; |
| 424 | 424 | } |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | $dataArchive->DataTransfers()->add($dataTransfer); |
| 469 | 469 | $form->saveInto($dataArchive); |
| 470 | 470 | $dataArchive->write(); |
| 471 | - $workingDir = TEMP_FOLDER . DIRECTORY_SEPARATOR . 'deploynaut-transfer-' . $dataTransfer->ID; |
|
| 471 | + $workingDir = TEMP_FOLDER.DIRECTORY_SEPARATOR.'deploynaut-transfer-'.$dataTransfer->ID; |
|
| 472 | 472 | |
| 473 | 473 | $cleanupFn = function() use($workingDir, $dataTransfer, $dataArchive) { |
| 474 | 474 | $process = new Process(sprintf('rm -rf %s', escapeshellarg($workingDir))); |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | $form->disableSecurityToken(); |
| 569 | 569 | $form->addExtraClass('fields-wide'); |
| 570 | 570 | // Tweak the action so it plays well with our fake URL structure. |
| 571 | - $form->setFormAction($project->Link() . '/PostSnapshotForm'); |
|
| 571 | + $form->setFormAction($project->Link().'/PostSnapshotForm'); |
|
| 572 | 572 | |
| 573 | 573 | return $form; |
| 574 | 574 | } |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | $branchName = $request->getVar('name'); |
| 708 | 708 | $branch = $project->DNBranchList()->byName($branchName); |
| 709 | 709 | if(!$branch) { |
| 710 | - return new SS_HTTPResponse("Branch '" . Convert::raw2xml($branchName) . "' not found.", 404); |
|
| 710 | + return new SS_HTTPResponse("Branch '".Convert::raw2xml($branchName)."' not found.", 404); |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | return $this->render(array( |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | ); |
| 844 | 844 | |
| 845 | 845 | // Tweak the action so it plays well with our fake URL structure. |
| 846 | - $form->setFormAction($project->Link() . '/CreateEnvironmentForm'); |
|
| 846 | + $form->setFormAction($project->Link().'/CreateEnvironmentForm'); |
|
| 847 | 847 | |
| 848 | 848 | return $form; |
| 849 | 849 | } |
@@ -876,7 +876,7 @@ discard block |
||
| 876 | 876 | $job->write(); |
| 877 | 877 | $job->start(); |
| 878 | 878 | |
| 879 | - return $this->redirect($project->Link('createenv') . '/' . $job->ID); |
|
| 879 | + return $this->redirect($project->Link('createenv').'/'.$job->ID); |
|
| 880 | 880 | } |
| 881 | 881 | |
| 882 | 882 | /** |
@@ -937,7 +937,7 @@ discard block |
||
| 937 | 937 | */ |
| 938 | 938 | public function getPlatformSpecificStrings() { |
| 939 | 939 | $strings = $this->config()->platform_specific_strings; |
| 940 | - if ($strings) { |
|
| 940 | + if($strings) { |
|
| 941 | 941 | return new ArrayList($strings); |
| 942 | 942 | } |
| 943 | 943 | } |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | |
| 1003 | 1003 | $isCurrentEnvironment = false; |
| 1004 | 1004 | if($project && $currentEnvironment) { |
| 1005 | - $isCurrentEnvironment = (bool) $project->DNEnvironmentList()->find('ID', $currentEnvironment->ID); |
|
| 1005 | + $isCurrentEnvironment = (bool)$project->DNEnvironmentList()->find('ID', $currentEnvironment->ID); |
|
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | 1008 | $navigation->push(array( |
@@ -1072,7 +1072,7 @@ discard block |
||
| 1072 | 1072 | return $body; |
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | - $form->setFormAction($this->getRequest()->getURL() . '/DeployForm'); |
|
| 1075 | + $form->setFormAction($this->getRequest()->getURL().'/DeployForm'); |
|
| 1076 | 1076 | return $form; |
| 1077 | 1077 | } |
| 1078 | 1078 | |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | } |
| 1229 | 1229 | |
| 1230 | 1230 | protected function applyRedeploy(SS_HTTPRequest $request, &$data) { |
| 1231 | - if (!$request->getVar('redeploy')) return; |
|
| 1231 | + if(!$request->getVar('redeploy')) return; |
|
| 1232 | 1232 | |
| 1233 | 1233 | $project = $this->getCurrentProject(); |
| 1234 | 1234 | if(!$project) { |
@@ -1242,12 +1242,12 @@ discard block |
||
| 1242 | 1242 | } |
| 1243 | 1243 | |
| 1244 | 1244 | $current = $env->CurrentBuild(); |
| 1245 | - if ($current && $current->exists()) { |
|
| 1245 | + if($current && $current->exists()) { |
|
| 1246 | 1246 | $data['preselect_tab'] = 3; |
| 1247 | 1247 | $data['preselect_sha'] = $current->SHA; |
| 1248 | 1248 | } else { |
| 1249 | 1249 | $master = $project->DNBranchList()->byName('master'); |
| 1250 | - if ($master) { |
|
| 1250 | + if($master) { |
|
| 1251 | 1251 | $data['preselect_tab'] = 1; |
| 1252 | 1252 | $data['preselect_sha'] = $master->SHA(); |
| 1253 | 1253 | } |
@@ -1378,7 +1378,7 @@ discard block |
||
| 1378 | 1378 | $deployment->getMachine()->apply('queue'); |
| 1379 | 1379 | |
| 1380 | 1380 | return json_encode(array( |
| 1381 | - 'url' => Director::absoluteBaseURL() . $deployment->Link() |
|
| 1381 | + 'url' => Director::absoluteBaseURL().$deployment->Link() |
|
| 1382 | 1382 | ), JSON_PRETTY_PRINT); |
| 1383 | 1383 | } |
| 1384 | 1384 | |
@@ -1482,7 +1482,7 @@ discard block |
||
| 1482 | 1482 | throw new LogicException("Project in URL doesn't match this deploy"); |
| 1483 | 1483 | } |
| 1484 | 1484 | |
| 1485 | - if (!in_array($deployment->Status, ['Queued', 'Deploying', 'Aborting'])) { |
|
| 1485 | + if(!in_array($deployment->Status, ['Queued', 'Deploying', 'Aborting'])) { |
|
| 1486 | 1486 | throw new LogicException(sprintf("Cannot abort from %s state.", $deployment->Status)); |
| 1487 | 1487 | } |
| 1488 | 1488 | |
@@ -1520,7 +1520,7 @@ discard block |
||
| 1520 | 1520 | ->addExtraClass('btn') |
| 1521 | 1521 | ) |
| 1522 | 1522 | ); |
| 1523 | - $form->setFormAction($this->getRequest()->getURL() . '/DataTransferForm'); |
|
| 1523 | + $form->setFormAction($this->getRequest()->getURL().'/DataTransferForm'); |
|
| 1524 | 1524 | |
| 1525 | 1525 | return $form; |
| 1526 | 1526 | } |
@@ -1722,7 +1722,7 @@ discard block |
||
| 1722 | 1722 | ->addExtraClass('btn') |
| 1723 | 1723 | ) |
| 1724 | 1724 | ); |
| 1725 | - $form->setFormAction($project->Link() . '/DataTransferRestoreForm'); |
|
| 1725 | + $form->setFormAction($project->Link().'/DataTransferRestoreForm'); |
|
| 1726 | 1726 | |
| 1727 | 1727 | return $form; |
| 1728 | 1728 | } |
@@ -1820,7 +1820,7 @@ discard block |
||
| 1820 | 1820 | ->addExtraClass('btn') |
| 1821 | 1821 | ) |
| 1822 | 1822 | ); |
| 1823 | - $form->setFormAction($project->Link() . '/DeleteForm'); |
|
| 1823 | + $form->setFormAction($project->Link().'/DeleteForm'); |
|
| 1824 | 1824 | |
| 1825 | 1825 | return $form; |
| 1826 | 1826 | } |
@@ -1926,7 +1926,7 @@ discard block |
||
| 1926 | 1926 | ->addExtraClass('btn') |
| 1927 | 1927 | ) |
| 1928 | 1928 | ); |
| 1929 | - $form->setFormAction($this->getCurrentProject()->Link() . '/MoveForm'); |
|
| 1929 | + $form->setFormAction($this->getCurrentProject()->Link().'/MoveForm'); |
|
| 1930 | 1930 | |
| 1931 | 1931 | return $form; |
| 1932 | 1932 | } |
@@ -2219,7 +2219,7 @@ discard block |
||
| 2219 | 2219 | */ |
| 2220 | 2220 | protected function project404Response() { |
| 2221 | 2221 | return new SS_HTTPResponse( |
| 2222 | - "Project '" . Convert::raw2xml($this->getRequest()->param('Project')) . "' not found.", |
|
| 2222 | + "Project '".Convert::raw2xml($this->getRequest()->param('Project'))."' not found.", |
|
| 2223 | 2223 | 404 |
| 2224 | 2224 | ); |
| 2225 | 2225 | } |
@@ -2229,7 +2229,7 @@ discard block |
||
| 2229 | 2229 | */ |
| 2230 | 2230 | protected function environment404Response() { |
| 2231 | 2231 | $envName = Convert::raw2xml($this->getRequest()->param('Environment')); |
| 2232 | - return new SS_HTTPResponse("Environment '" . $envName . "' not found.", 404); |
|
| 2232 | + return new SS_HTTPResponse("Environment '".$envName."' not found.", 404); |
|
| 2233 | 2233 | } |
| 2234 | 2234 | |
| 2235 | 2235 | /** |
@@ -2296,7 +2296,7 @@ discard block |
||
| 2296 | 2296 | public function AmbientMenu() { |
| 2297 | 2297 | $list = new ArrayList(); |
| 2298 | 2298 | |
| 2299 | - if (Member::currentUserID()) { |
|
| 2299 | + if(Member::currentUserID()) { |
|
| 2300 | 2300 | $list->push(new ArrayData(array( |
| 2301 | 2301 | 'Classes' => 'logout', |
| 2302 | 2302 | 'FaIcon' => 'sign-out', |