@@ -31,7 +31,7 @@ |
||
31 | 31 | * Do the actual job by calling the appropiate backend |
32 | 32 | */ |
33 | 33 | public function perform() { |
34 | - echo "[-] PingJob starting" . PHP_EOL; |
|
34 | + echo "[-] PingJob starting".PHP_EOL; |
|
35 | 35 | $log = new DeploynautLogFile($this->args['logfile']); |
36 | 36 | |
37 | 37 | $ping = DNPing::get()->byID($this->args['pingID']); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | substr($sha, 0, 8), |
74 | 74 | $branch->LastUpdated()->TimeDiff() |
75 | 75 | ); |
76 | - $branches[$sha . '-' . $name] = $branchValue; |
|
76 | + $branches[$sha.'-'.$name] = $branchValue; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // Tags |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | substr($sha, 0, 8), |
87 | 87 | $branch->LastUpdated()->TimeDiff() |
88 | 88 | ); |
89 | - $tags[$sha . '-' . $tag] = $tagValue; |
|
89 | + $tags[$sha.'-'.$tag] = $tagValue; |
|
90 | 90 | } |
91 | 91 | $tags = array_reverse($tags); |
92 | 92 |
@@ -10,7 +10,7 @@ |
||
10 | 10 | // This will ensure jobs can correctly clean themselves up on any type of failure |
11 | 11 | Resque_Event::listen('onFailure', function(Exception $exception, Resque_job $job) { |
12 | 12 | $inst = $job->getInstance(); |
13 | - if($inst instanceof DeploynautJobInterface) { |
|
13 | + if ($inst instanceof DeploynautJobInterface) { |
|
14 | 14 | $inst->onFailure($exception); |
15 | 15 | } |
16 | 16 | }); |
@@ -63,9 +63,9 @@ |
||
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(), |
@@ -178,7 +178,7 @@ 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')) { |
|
181 | + if (!is_dir(BASE_PATH.DIRECTORY_SEPARATOR.'static')) { |
|
182 | 182 | if (\Director::isDev()) { |
183 | 183 | \Requirements::javascript('deploynaut/static/bundle-debug.js'); |
184 | 184 | } else { |
@@ -242,7 +242,7 @@ discard block |
||
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 | /** |
@@ -389,7 +389,7 @@ discard block |
||
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 = []; |
@@ -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 | } |
@@ -442,7 +442,7 @@ discard block |
||
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 | |
@@ -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(); |
@@ -547,7 +547,7 @@ discard block |
||
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 = []; |
@@ -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 | } |
@@ -592,7 +592,7 @@ discard block |
||
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 | |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | $branchName = $request->getVar('name'); |
713 | 713 | $branch = $project->DNBranchList()->byName($branchName); |
714 | 714 | if (!$branch) { |
715 | - return new SS_HTTPResponse("Branch '" . Convert::raw2xml($branchName) . "' not found.", 404); |
|
715 | + return new SS_HTTPResponse("Branch '".Convert::raw2xml($branchName)."' not found.", 404); |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | return $this->render([ |
@@ -740,7 +740,7 @@ discard block |
||
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 | |
@@ -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 | } |
@@ -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 | /** |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | |
1009 | 1009 | $isCurrentEnvironment = false; |
1010 | 1010 | if ($project && $currentEnvironment) { |
1011 | - $isCurrentEnvironment = (bool) $project->DNEnvironmentList()->find('ID', $currentEnvironment->ID); |
|
1011 | + $isCurrentEnvironment = (bool)$project->DNEnvironmentList()->find('ID', $currentEnvironment->ID); |
|
1012 | 1012 | } |
1013 | 1013 | |
1014 | 1014 | $navigation->push([ |
@@ -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 | |
@@ -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 | |
@@ -1469,7 +1469,7 @@ 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 | |
@@ -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 | } |
@@ -1517,12 +1517,12 @@ discard block |
||
1517 | 1517 | // Validate direction. |
1518 | 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 | 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 { |
@@ -1653,7 +1653,7 @@ 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 | |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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() || |
@@ -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 | /** |
@@ -96,7 +96,7 @@ |
||
96 | 96 | // It gives a chance to perform a dry-run, and reject the transition, for example |
97 | 97 | // in case the user is unauthorised. |
98 | 98 | 'finite.test_transition', |
99 | - function (Finite\Event\TransitionEvent $e) use ($project) { |
|
99 | + function(Finite\Event\TransitionEvent $e) use ($project) { |
|
100 | 100 | $code = null; |
101 | 101 | |
102 | 102 | switch ($e->getTransition()->getName()) { |
@@ -75,7 +75,7 @@ |
||
75 | 75 | $page = 1; |
76 | 76 | } |
77 | 77 | $start = ($page - 1) * $list->getPageLength(); |
78 | - $list->setPageStart((int) $start); |
|
78 | + $list->setPageStart((int)$start); |
|
79 | 79 | if (empty($list)) { |
80 | 80 | return $this->getAPIResponse(['list' => []], 200); |
81 | 81 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | protected function getUpdateStatus($ID) { |
134 | 134 | $ping = DNGitFetch::get()->byID($ID); |
135 | 135 | if (!$ping) { |
136 | - return $this->getAPIResponse(['message' => 'GIT update (' . $ID . ') not found'], 404); |
|
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, |
@@ -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 | /** |
@@ -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 | /** |