@@ -75,6 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
78 | + * @param string $code |
|
78 | 79 | */ |
79 | 80 | public function setActionCode($code) { |
80 | 81 | $this->actionCode = $code; |
@@ -89,6 +90,7 @@ discard block |
||
89 | 90 | |
90 | 91 | /** |
91 | 92 | * @param int |
93 | + * @param string $seconds |
|
92 | 94 | */ |
93 | 95 | public function setEstimatedTime($seconds) { |
94 | 96 | $this->estimatedTime = $seconds; |
@@ -110,8 +110,12 @@ |
||
110 | 110 | // Normalise "empty" values into dashes so comparisons are done properly. |
111 | 111 | // This means there is no diference between an empty string and a null |
112 | 112 | // but "0" is considered to be non-empty. |
113 | - if(empty($from) && !strlen($from)) $from = '-'; |
|
114 | - if(empty($to) && !strlen($to)) $to = '-'; |
|
113 | + if(empty($from) && !strlen($from)) { |
|
114 | + $from = '-'; |
|
115 | + } |
|
116 | + if(empty($to) && !strlen($to)) { |
|
117 | + $to = '-'; |
|
118 | + } |
|
115 | 119 | |
116 | 120 | return $this->changes[$title] = array( |
117 | 121 | 'from' => $from, |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | // Normalise "empty" values into dashes so comparisons are done properly. |
111 | 111 | // This means there is no diference between an empty string and a null |
112 | 112 | // but "0" is considered to be non-empty. |
113 | - if(empty($from) && !strlen($from)) $from = '-'; |
|
114 | - if(empty($to) && !strlen($to)) $to = '-'; |
|
113 | + if (empty($from) && !strlen($from)) $from = '-'; |
|
114 | + if (empty($to) && !strlen($to)) $to = '-'; |
|
115 | 115 | |
116 | 116 | return $this->changes[$title] = array( |
117 | 117 | 'from' => $from, |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function getChange($key) { |
172 | 172 | $changes = $this->getChanges(); |
173 | - if(array_key_exists($key, $changes)) { |
|
173 | + if (array_key_exists($key, $changes)) { |
|
174 | 174 | return new ArrayData($changes[$key]); |
175 | 175 | } |
176 | 176 | return null; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @return string|null |
190 | 190 | */ |
191 | 191 | public function getOption($option) { |
192 | - if(!empty($this->options[$option])) { |
|
192 | + if (!empty($this->options[$option])) { |
|
193 | 193 | return $this->options[$option]; |
194 | 194 | } |
195 | 195 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | DeploymentStrategy::WARNING_CODE => 1, |
231 | 231 | DeploymentStrategy::ERROR_CODE => 2 |
232 | 232 | ]; |
233 | - if($map[$current] < $map[$code]) { |
|
233 | + if ($map[$current] < $map[$code]) { |
|
234 | 234 | $this->setValidationCode($code); |
235 | 235 | } |
236 | 236 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | ); |
260 | 260 | |
261 | 261 | $output = array(); |
262 | - foreach($fields as $field) { |
|
262 | + foreach ($fields as $field) { |
|
263 | 263 | $output[$field] = $this->$field; |
264 | 264 | } |
265 | 265 | return $output; |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | 'messages' |
301 | 301 | ); |
302 | 302 | |
303 | - foreach($fields as $field) { |
|
304 | - if(!empty($data[$field])) { |
|
303 | + foreach ($fields as $field) { |
|
304 | + if (!empty($data[$field])) { |
|
305 | 305 | $this->$field = $data[$field]; |
306 | 306 | } |
307 | 307 | } |
@@ -954,7 +954,7 @@ |
||
954 | 954 | to other environments, alongside the "Who can restore" permission.<br> |
955 | 955 | Should include all users with upload permissions, otherwise they can't download |
956 | 956 | their own uploads. |
957 | -PHP |
|
957 | +php |
|
958 | 958 | ), |
959 | 959 | |
960 | 960 | // The Main.PipelineApprovers |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | ->buildPermissionField('ArchiveUploaderGroups', 'ArchiveUploaders', $groups, $members) |
775 | 775 | ->setTitle('Who can upload?') |
776 | 776 | ->setDescription( |
777 | - 'Users who can upload archives linked to this environment into Deploynaut.<br />' . |
|
777 | + 'Users who can upload archives linked to this environment into Deploynaut.<br />'. |
|
778 | 778 | 'Linking them to an environment allows limiting download permissions (see below).' |
779 | 779 | ), |
780 | 780 | |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | // Add actions |
822 | 822 | $action = new FormAction('check', 'Check Connection'); |
823 | 823 | $action->setUseButtonTag(true); |
824 | - $dataURL = Director::absoluteBaseURL() . 'naut/api/' . $this->Project()->Name . '/' . $this->Name . '/ping'; |
|
824 | + $dataURL = Director::absoluteBaseURL().'naut/api/'.$this->Project()->Name.'/'.$this->Name.'/ping'; |
|
825 | 825 | $action->setAttribute('data-url', $dataURL); |
826 | 826 | $fields->insertBefore($action, 'Name'); |
827 | 827 | |
@@ -834,8 +834,8 @@ discard block |
||
834 | 834 | */ |
835 | 835 | public function onBeforeWrite() { |
836 | 836 | parent::onBeforeWrite(); |
837 | - if ($this->Name && $this->Name . '.rb' != $this->Filename) { |
|
838 | - $this->Filename = $this->Name . '.rb'; |
|
837 | + if ($this->Name && $this->Name.'.rb' != $this->Filename) { |
|
838 | + $this->Filename = $this->Name.'.rb'; |
|
839 | 839 | } |
840 | 840 | $this->checkEnvironmentPath(); |
841 | 841 | $this->writeConfigFile(); |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | if (!$this->Filename) { |
886 | 886 | return ''; |
887 | 887 | } |
888 | - return $this->DNData()->getEnvironmentDir() . '/' . $this->Project()->Name . '/' . $this->Filename; |
|
888 | + return $this->DNData()->getEnvironmentDir().'/'.$this->Project()->Name.'/'.$this->Filename; |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | /** |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | && $this->Filename |
1040 | 1040 | && $this->CreateEnvConfig |
1041 | 1041 | ) { |
1042 | - $templateFile = $this->config()->template_file ?: BASE_PATH . '/deploynaut/environment.template'; |
|
1042 | + $templateFile = $this->config()->template_file ?: BASE_PATH.'/deploynaut/environment.template'; |
|
1043 | 1043 | file_put_contents($this->getConfigFilename(), file_get_contents($templateFile)); |
1044 | 1044 | } else if ($this->envFileExists() && $this->DeployConfig) { |
1045 | 1045 | file_put_contents($this->getConfigFilename(), $this->DeployConfig); |
@@ -670,7 +670,7 @@ |
||
670 | 670 | /** |
671 | 671 | * A list of past deployments. |
672 | 672 | * @param string $orderBy - the name of a DB column to sort in descending order |
673 | - * @return \ArrayList |
|
673 | + * @return DataList |
|
674 | 674 | */ |
675 | 675 | public function DeployHistory($orderBy = '') { |
676 | 676 | $sort = []; |
@@ -961,7 +961,7 @@ |
||
961 | 961 | * @param array $data |
962 | 962 | * @param Form $form |
963 | 963 | * |
964 | - * @return bool|HTMLText|SS_HTTPResponse |
|
964 | + * @return SS_HTTPResponse|null |
|
965 | 965 | */ |
966 | 966 | public function doCreateEnvironment($data, Form $form) { |
967 | 967 | $this->setCurrentActionType(self::ACTION_ENVIRONMENTS); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | Requirements::javascript('deploynaut/javascript/material.js'); |
178 | 178 | |
179 | 179 | // Load the buildable dependencies only if not loaded centrally. |
180 | - if (!is_dir(BASE_PATH . DIRECTORY_SEPARATOR . 'static')) { |
|
180 | + if (!is_dir(BASE_PATH.DIRECTORY_SEPARATOR.'static')) { |
|
181 | 181 | if (\Director::isDev()) { |
182 | 182 | \Requirements::javascript('deploynaut/static/bundle-debug.js'); |
183 | 183 | } else { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | } |
221 | 221 | |
222 | 222 | // Block framework jquery |
223 | - Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js'); |
|
223 | + Requirements::block(FRAMEWORK_DIR.'/thirdparty/jquery/jquery.js'); |
|
224 | 224 | |
225 | 225 | self::include_requirements(); |
226 | 226 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * @return \SS_HTTPResponse |
240 | 240 | */ |
241 | 241 | public function index(\SS_HTTPRequest $request) { |
242 | - return $this->redirect($this->Link() . 'projects/'); |
|
242 | + return $this->redirect($this->Link().'projects/'); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | // Framing an environment as a "group of people with download access" |
368 | 368 | // makes more sense to the user here, while still allowing us to enforce |
369 | 369 | // environment specific restrictions on downloading the file later on. |
370 | - $envs = $project->DNEnvironmentList()->filterByCallback(function ($item) { |
|
370 | + $envs = $project->DNEnvironmentList()->filterByCallback(function($item) { |
|
371 | 371 | return $item->canUploadArchive(); |
372 | 372 | }); |
373 | 373 | $envsMap = []; |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $form->disableSecurityToken(); |
400 | 400 | $form->addExtraClass('fields-wide'); |
401 | 401 | // Tweak the action so it plays well with our fake URL structure. |
402 | - $form->setFormAction($project->Link() . '/UploadSnapshotForm'); |
|
402 | + $form->setFormAction($project->Link().'/UploadSnapshotForm'); |
|
403 | 403 | |
404 | 404 | return $form; |
405 | 405 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | } |
421 | 421 | |
422 | 422 | $validEnvs = $project->DNEnvironmentList() |
423 | - ->filterByCallback(function ($item) { |
|
423 | + ->filterByCallback(function($item) { |
|
424 | 424 | return $item->canUploadArchive(); |
425 | 425 | }); |
426 | 426 | |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | $dataArchive->DataTransfers()->add($dataTransfer); |
450 | 450 | $form->saveInto($dataArchive); |
451 | 451 | $dataArchive->write(); |
452 | - $workingDir = TEMP_FOLDER . DIRECTORY_SEPARATOR . 'deploynaut-transfer-' . $dataTransfer->ID; |
|
452 | + $workingDir = TEMP_FOLDER.DIRECTORY_SEPARATOR.'deploynaut-transfer-'.$dataTransfer->ID; |
|
453 | 453 | |
454 | - $cleanupFn = function () use ($workingDir, $dataTransfer, $dataArchive) { |
|
454 | + $cleanupFn = function() use ($workingDir, $dataTransfer, $dataArchive) { |
|
455 | 455 | $process = new AbortableProcess(sprintf('rm -rf %s', escapeshellarg($workingDir))); |
456 | 456 | $process->setTimeout(120); |
457 | 457 | $process->run(); |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | // Framing an environment as a "group of people with download access" |
526 | 526 | // makes more sense to the user here, while still allowing us to enforce |
527 | 527 | // environment specific restrictions on downloading the file later on. |
528 | - $envs = $project->DNEnvironmentList()->filterByCallback(function ($item) { |
|
528 | + $envs = $project->DNEnvironmentList()->filterByCallback(function($item) { |
|
529 | 529 | return $item->canUploadArchive(); |
530 | 530 | }); |
531 | 531 | $envsMap = []; |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | $form->disableSecurityToken(); |
552 | 552 | $form->addExtraClass('fields-wide'); |
553 | 553 | // Tweak the action so it plays well with our fake URL structure. |
554 | - $form->setFormAction($project->Link() . '/PostSnapshotForm'); |
|
554 | + $form->setFormAction($project->Link().'/PostSnapshotForm'); |
|
555 | 555 | |
556 | 556 | return $form; |
557 | 557 | } |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | return $this->project404Response(); |
571 | 571 | } |
572 | 572 | |
573 | - $validEnvs = $project->DNEnvironmentList()->filterByCallback(function ($item) { |
|
573 | + $validEnvs = $project->DNEnvironmentList()->filterByCallback(function($item) { |
|
574 | 574 | return $item->canUploadArchive(); |
575 | 575 | }); |
576 | 576 | |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | $branchName = $request->getVar('name'); |
694 | 694 | $branch = $project->DNBranchList()->byName($branchName); |
695 | 695 | if (!$branch) { |
696 | - return new SS_HTTPResponse("Branch '" . Convert::raw2xml($branchName) . "' not found.", 404); |
|
696 | + return new SS_HTTPResponse("Branch '".Convert::raw2xml($branchName)."' not found.", 404); |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | return $this->render([ |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | ); |
830 | 830 | |
831 | 831 | // Tweak the action so it plays well with our fake URL structure. |
832 | - $form->setFormAction($project->Link() . '/CreateEnvironmentForm'); |
|
832 | + $form->setFormAction($project->Link().'/CreateEnvironmentForm'); |
|
833 | 833 | |
834 | 834 | return $form; |
835 | 835 | } |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | $job->write(); |
863 | 863 | $job->start(); |
864 | 864 | |
865 | - return $this->redirect($project->Link('createenv') . '/' . $job->ID); |
|
865 | + return $this->redirect($project->Link('createenv').'/'.$job->ID); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | /** |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | return $body; |
1040 | 1040 | } |
1041 | 1041 | |
1042 | - $form->setFormAction($this->getRequest()->getURL() . '/DeployForm'); |
|
1042 | + $form->setFormAction($this->getRequest()->getURL().'/DeployForm'); |
|
1043 | 1043 | return $form; |
1044 | 1044 | } |
1045 | 1045 | |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | $deployment->getMachine()->apply(DNDeployment::TR_QUEUE); |
1308 | 1308 | |
1309 | 1309 | return json_encode([ |
1310 | - 'url' => Director::absoluteBaseURL() . $deployment->Link() |
|
1310 | + 'url' => Director::absoluteBaseURL().$deployment->Link() |
|
1311 | 1311 | ], JSON_PRETTY_PRINT); |
1312 | 1312 | } |
1313 | 1313 | |
@@ -1438,7 +1438,7 @@ discard block |
||
1438 | 1438 | */ |
1439 | 1439 | public function getDataTransferForm(\SS_HTTPRequest $request = null) { |
1440 | 1440 | // Performs canView permission check by limiting visible projects |
1441 | - $envs = $this->getCurrentProject()->DNEnvironmentList()->filterByCallback(function ($item) { |
|
1441 | + $envs = $this->getCurrentProject()->DNEnvironmentList()->filterByCallback(function($item) { |
|
1442 | 1442 | return $item->canBackup(); |
1443 | 1443 | }); |
1444 | 1444 | |
@@ -1448,7 +1448,7 @@ discard block |
||
1448 | 1448 | |
1449 | 1449 | $items = []; |
1450 | 1450 | $disabledEnvironments = []; |
1451 | - foreach($envs as $env) { |
|
1451 | + foreach ($envs as $env) { |
|
1452 | 1452 | $items[$env->ID] = $env->Title; |
1453 | 1453 | if ($env->CurrentBuild() === false) { |
1454 | 1454 | $items[$env->ID] = sprintf("%s - requires initial deployment", $env->Title); |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | $fields, |
1490 | 1490 | FieldList::create($formAction) |
1491 | 1491 | ); |
1492 | - $form->setFormAction($this->getRequest()->getURL() . '/DataTransferForm'); |
|
1492 | + $form->setFormAction($this->getRequest()->getURL().'/DataTransferForm'); |
|
1493 | 1493 | |
1494 | 1494 | return $form; |
1495 | 1495 | } |
@@ -1515,12 +1515,12 @@ discard block |
||
1515 | 1515 | // Validate direction. |
1516 | 1516 | if ($data['Direction'] == 'get') { |
1517 | 1517 | $validEnvs = $this->getCurrentProject()->DNEnvironmentList() |
1518 | - ->filterByCallback(function ($item) { |
|
1518 | + ->filterByCallback(function($item) { |
|
1519 | 1519 | return $item->canBackup(); |
1520 | 1520 | }); |
1521 | 1521 | } else if ($data['Direction'] == 'push') { |
1522 | 1522 | $validEnvs = $this->getCurrentProject()->DNEnvironmentList() |
1523 | - ->filterByCallback(function ($item) { |
|
1523 | + ->filterByCallback(function($item) { |
|
1524 | 1524 | return $item->canRestore(); |
1525 | 1525 | }); |
1526 | 1526 | } else { |
@@ -1652,7 +1652,7 @@ discard block |
||
1652 | 1652 | |
1653 | 1653 | // Performs canView permission check by limiting visible projects |
1654 | 1654 | $project = $this->getCurrentProject(); |
1655 | - $envs = $project->DNEnvironmentList()->filterByCallback(function ($item) { |
|
1655 | + $envs = $project->DNEnvironmentList()->filterByCallback(function($item) { |
|
1656 | 1656 | return $item->canRestore(); |
1657 | 1657 | }); |
1658 | 1658 | |
@@ -1677,7 +1677,7 @@ discard block |
||
1677 | 1677 | |
1678 | 1678 | $items = []; |
1679 | 1679 | $disabledEnvironments = []; |
1680 | - foreach($envs as $env) { |
|
1680 | + foreach ($envs as $env) { |
|
1681 | 1681 | $items[$env->ID] = $env->Title; |
1682 | 1682 | if ($env->CurrentBuild() === false) { |
1683 | 1683 | $items[$env->ID] = sprintf("%s - requires initial deployment", $env->Title); |
@@ -1707,7 +1707,7 @@ discard block |
||
1707 | 1707 | ), |
1708 | 1708 | FieldList::create($formAction) |
1709 | 1709 | ); |
1710 | - $form->setFormAction($project->Link() . '/DataTransferRestoreForm'); |
|
1710 | + $form->setFormAction($project->Link().'/DataTransferRestoreForm'); |
|
1711 | 1711 | |
1712 | 1712 | return $form; |
1713 | 1713 | } |
@@ -1805,7 +1805,7 @@ discard block |
||
1805 | 1805 | ->addExtraClass('btn') |
1806 | 1806 | ) |
1807 | 1807 | ); |
1808 | - $form->setFormAction($project->Link() . '/DeleteForm'); |
|
1808 | + $form->setFormAction($project->Link().'/DeleteForm'); |
|
1809 | 1809 | |
1810 | 1810 | return $form; |
1811 | 1811 | } |
@@ -1911,7 +1911,7 @@ discard block |
||
1911 | 1911 | ->addExtraClass('btn') |
1912 | 1912 | ) |
1913 | 1913 | ); |
1914 | - $form->setFormAction($this->getCurrentProject()->Link() . '/MoveForm'); |
|
1914 | + $form->setFormAction($this->getCurrentProject()->Link().'/MoveForm'); |
|
1915 | 1915 | |
1916 | 1916 | return $form; |
1917 | 1917 | } |
@@ -2172,7 +2172,7 @@ discard block |
||
2172 | 2172 | $transfers = DNDataTransfer::get() |
2173 | 2173 | ->filter('EnvironmentID', $environments) |
2174 | 2174 | ->filterByCallback( |
2175 | - function ($record) { |
|
2175 | + function($record) { |
|
2176 | 2176 | return |
2177 | 2177 | $record->Environment()->canRestore() || // Ensure member can perform an action on the transfers env |
2178 | 2178 | $record->Environment()->canBackup() || |
@@ -2297,7 +2297,7 @@ discard block |
||
2297 | 2297 | */ |
2298 | 2298 | protected function project404Response() { |
2299 | 2299 | return new SS_HTTPResponse( |
2300 | - "Project '" . Convert::raw2xml($this->getRequest()->param('Project')) . "' not found.", |
|
2300 | + "Project '".Convert::raw2xml($this->getRequest()->param('Project'))."' not found.", |
|
2301 | 2301 | 404 |
2302 | 2302 | ); |
2303 | 2303 | } |
@@ -2307,7 +2307,7 @@ discard block |
||
2307 | 2307 | */ |
2308 | 2308 | protected function environment404Response() { |
2309 | 2309 | $envName = Convert::raw2xml($this->getRequest()->param('Environment')); |
2310 | - return new SS_HTTPResponse("Environment '" . $envName . "' not found.", 404); |
|
2310 | + return new SS_HTTPResponse("Environment '".$envName."' not found.", 404); |
|
2311 | 2311 | } |
2312 | 2312 | |
2313 | 2313 | /** |
@@ -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']); |
@@ -205,12 +205,16 @@ |
||
205 | 205 | */ |
206 | 206 | public function getFullDeployMessages() { |
207 | 207 | $strategy = $this->getDeploymentStrategy(); |
208 | - if ($strategy->getActionCode()!=='full') return null; |
|
208 | + if ($strategy->getActionCode()!=='full') { |
|
209 | + return null; |
|
210 | + } |
|
209 | 211 | |
210 | 212 | $changes = $strategy->getChangesModificationNeeded(); |
211 | 213 | $messages = []; |
212 | 214 | foreach ($changes as $change => $details) { |
213 | - if ($change==='Code version') continue; |
|
215 | + if ($change==='Code version') { |
|
216 | + continue; |
|
217 | + } |
|
214 | 218 | |
215 | 219 | $messages[] = [ |
216 | 220 | 'Flag' => sprintf( |
@@ -82,6 +82,9 @@ |
||
82 | 82 | 'Deployer.Name' => 'Deployer' |
83 | 83 | ); |
84 | 84 | |
85 | + /** |
|
86 | + * @param false|string $token |
|
87 | + */ |
|
85 | 88 | public function setResqueToken($token) { |
86 | 89 | $this->ResqueToken = $token; |
87 | 90 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | public function LogLink() { |
119 | - return $this->Link() . '/log'; |
|
119 | + return $this->Link().'/log'; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | public function canView($member = null) { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @return \Gitonomy\Git\Repository|null |
163 | 163 | */ |
164 | 164 | public function getRepository() { |
165 | - if(!$this->SHA) { |
|
165 | + if (!$this->SHA) { |
|
166 | 166 | return null; |
167 | 167 | } |
168 | 168 | return $this->Environment()->Project()->getRepository(); |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function getCommit() { |
177 | 177 | $repo = $this->getRepository(); |
178 | - if($repo) { |
|
178 | + if ($repo) { |
|
179 | 179 | try { |
180 | 180 | return $this->Environment()->getCommit($this->SHA); |
181 | - } catch(Gitonomy\Git\Exception\ReferenceNotFoundException $ex) { |
|
181 | + } catch (Gitonomy\Git\Exception\ReferenceNotFoundException $ex) { |
|
182 | 182 | return null; |
183 | 183 | } |
184 | 184 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | if (!$interface) { |
204 | 204 | return null; |
205 | 205 | } |
206 | - return $interface->CommitURL . '/' . $this->SHA; |
|
206 | + return $interface->CommitURL.'/'.$this->SHA; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function getCommitMessage() { |
215 | 215 | $commit = $this->getCommit(); |
216 | - if($commit) { |
|
216 | + if ($commit) { |
|
217 | 217 | try { |
218 | 218 | return Convert::raw2xml($this->Environment()->getCommitMessage($commit)); |
219 | - } catch(Gitonomy\Git\Exception\ReferenceNotFoundException $e) { |
|
219 | + } catch (Gitonomy\Git\Exception\ReferenceNotFoundException $e) { |
|
220 | 220 | return null; |
221 | 221 | } |
222 | 222 | } |
@@ -230,10 +230,10 @@ discard block |
||
230 | 230 | */ |
231 | 231 | public function getCommitSubjectMessage() { |
232 | 232 | $commit = $this->getCommit(); |
233 | - if($commit) { |
|
233 | + if ($commit) { |
|
234 | 234 | try { |
235 | 235 | return Convert::raw2xml($this->Environment()->getCommitSubjectMessage($commit)); |
236 | - } catch(Gitonomy\Git\Exception\ReferenceNotFoundException $e) { |
|
236 | + } catch (Gitonomy\Git\Exception\ReferenceNotFoundException $e) { |
|
237 | 237 | return null; |
238 | 238 | } |
239 | 239 | } |
@@ -247,13 +247,13 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function getTags() { |
249 | 249 | $commit = $this->Environment()->getCommit($this->SHA); |
250 | - if(!$commit) { |
|
250 | + if (!$commit) { |
|
251 | 251 | return new ArrayList([]); |
252 | 252 | } |
253 | 253 | $tags = $this->Environment()->getCommitTags($commit); |
254 | 254 | $returnTags = []; |
255 | 255 | if (!empty($tags)) { |
256 | - foreach($tags as $tag) { |
|
256 | + foreach ($tags as $tag) { |
|
257 | 257 | $field = Varchar::create('Tag', '255'); |
258 | 258 | $field->setValue($tag->getName()); |
259 | 259 | $returnTags[] = $field; |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | */ |
271 | 271 | public function getFullDeployMessages() { |
272 | 272 | $strategy = $this->getDeploymentStrategy(); |
273 | - if ($strategy->getActionCode()!=='full') return null; |
|
273 | + if ($strategy->getActionCode() !== 'full') return null; |
|
274 | 274 | |
275 | 275 | $changes = $strategy->getChangesModificationNeeded(); |
276 | 276 | $messages = []; |
277 | 277 | foreach ($changes as $change => $details) { |
278 | - if ($change==='Code version') continue; |
|
278 | + if ($change === 'Code version') continue; |
|
279 | 279 | |
280 | 280 | $messages[] = [ |
281 | 281 | 'Flag' => sprintf( |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | */ |
304 | 304 | public function getTag() { |
305 | 305 | $tags = $this->getTags(); |
306 | - if($tags->count() > 0) { |
|
306 | + if ($tags->count() > 0) { |
|
307 | 307 | return $tags->last(); |
308 | 308 | } |
309 | 309 | return null; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | public function getChanges() { |
329 | 329 | $list = new ArrayList(); |
330 | 330 | $strategy = $this->getDeploymentStrategy(); |
331 | - foreach($strategy->getChanges() as $name => $change) { |
|
331 | + foreach ($strategy->getChanges() as $name => $change) { |
|
332 | 332 | $changed = (isset($change['from']) && isset($change['to'])) ? $change['from'] != $change['to'] : null; |
333 | 333 | $description = isset($change['description']) ? $change['description'] : ''; |
334 | 334 | $compareUrl = null; |
@@ -378,11 +378,11 @@ discard block |
||
378 | 378 | // Make sure we use the SHA as it was written into this DNDeployment. |
379 | 379 | $args['sha'] = $this->SHA; |
380 | 380 | |
381 | - if(!$this->DeployerID) { |
|
381 | + if (!$this->DeployerID) { |
|
382 | 382 | $this->DeployerID = Member::currentUserID(); |
383 | 383 | } |
384 | 384 | |
385 | - if($this->DeployerID) { |
|
385 | + if ($this->DeployerID) { |
|
386 | 386 | $deployer = $this->Deployer(); |
387 | 387 | $message = sprintf( |
388 | 388 | 'Deploy to %s initiated by %s (%s), with IP address %s', |
@@ -58,7 +58,9 @@ |
||
58 | 58 | |
59 | 59 | protected function addHandlers($machine) { |
60 | 60 | $class = get_class($machine->getObject()); |
61 | - if (empty($this->config()->handlers[$class])) return; |
|
61 | + if (empty($this->config()->handlers[$class])) { |
|
62 | + return; |
|
63 | + } |
|
62 | 64 | |
63 | 65 | $transitions = $this->config()->handlers[$class]; |
64 | 66 | foreach ($transitions as $transName => $handlers) { |
@@ -46,7 +46,7 @@ |
||
46 | 46 | * |
47 | 47 | * @param \SS_HTTPRequest $request |
48 | 48 | * |
49 | - * @return \HTMLText|\SS_HTTPResponse |
|
49 | + * @return SS_HTTPResponse|null |
|
50 | 50 | */ |
51 | 51 | public function index(\SS_HTTPRequest $request) { |
52 | 52 | return $this->redirect(\Controller::join_links($this->Link(), 'history'), 302); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @param \SS_HTTPRequest $request |
49 | 49 | * |
50 | - * @return \HTMLText|\SS_HTTPResponse |
|
50 | + * @return SS_HTTPResponse|null |
|
51 | 51 | */ |
52 | 52 | public function index(\SS_HTTPRequest $request) { |
53 | 53 | return $this->redirect(\Controller::join_links($this->Link(), 'show'), 302); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * @param SS_HTTPRequest $request |
74 | 74 | * |
75 | - * @return string |
|
75 | + * @return SS_HTTPResponse |
|
76 | 76 | */ |
77 | 77 | public function show(\SS_HTTPRequest $request) { |
78 | 78 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
169 | - * @param $project |
|
169 | + * @param DNProject $project |
|
170 | 170 | * |
171 | 171 | * @return array |
172 | 172 | */ |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
185 | - * @param $project |
|
185 | + * @param DNProject $project |
|
186 | 186 | * |
187 | 187 | * @return array |
188 | 188 | */ |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
201 | - * @param $project |
|
201 | + * @param DNProject $project |
|
202 | 202 | * |
203 | 203 | * @return array |
204 | 204 | */ |
@@ -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, |
@@ -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 | }); |