@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | $ping->write(); |
| 113 | 113 | $ping->start(); |
| 114 | 114 | |
| 115 | - $location = Director::absoluteBaseURL() . $this->Link() . '/ping/' . $ping->ID; |
|
| 115 | + $location = Director::absoluteBaseURL().$this->Link().'/ping/'.$ping->ID; |
|
| 116 | 116 | $output = array( |
| 117 | - 'message' => 'Ping queued as job ' . $ping->ResqueToken, |
|
| 117 | + 'message' => 'Ping queued as job '.$ping->ResqueToken, |
|
| 118 | 118 | 'href' => $location, |
| 119 | 119 | ); |
| 120 | 120 | |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | )); |
| 165 | 165 | $deploy = $strategy->createDeployment(); |
| 166 | 166 | $deploy->start(); |
| 167 | - $location = Director::absoluteBaseURL() . $this->Link() . '/deploy/' . $deploy->ID; |
|
| 167 | + $location = Director::absoluteBaseURL().$this->Link().'/deploy/'.$deploy->ID; |
|
| 168 | 168 | $output = array( |
| 169 | - 'message' => 'Deploy queued as job ' . $deploy->ResqueToken, |
|
| 169 | + 'message' => 'Deploy queued as job '.$deploy->ResqueToken, |
|
| 170 | 170 | 'href' => $location, |
| 171 | 171 | ); |
| 172 | 172 | $response = $this->getAPIResponse($output); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | protected function project404Response() { |
| 107 | 107 | $projectName = Convert::raw2xml($this->getRequest()->latestParam('Project')); |
| 108 | - return new SS_HTTPResponse('Project "' . $projectName . '" not found.', 404); |
|
| 108 | + return new SS_HTTPResponse('Project "'.$projectName.'" not found.', 404); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | protected function environment404Response() { |
| 115 | 115 | $envName = Convert::raw2xml($this->getRequest()->latestParam('Environment')); |
| 116 | - return new SS_HTTPResponse('Environment "' . $envName . '" not found.', 404); |
|
| 116 | + return new SS_HTTPResponse('Environment "'.$envName.'" not found.', 404); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -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']); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | */ |
| 21 | 21 | public function perform() { |
| 22 | - echo "[-] CreateEnvJob starting" . PHP_EOL; |
|
| 22 | + echo "[-] CreateEnvJob starting".PHP_EOL; |
|
| 23 | 23 | // This is a bit icky, but there is no easy way of capturing a failed deploy by using the PHP Resque |
| 24 | 24 | try { |
| 25 | 25 | $envCreate = DNCreateEnvironment::get()->byId($this->args['createID']); |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | $envCreate->createEnvironment(); |
| 32 | 32 | |
| 33 | 33 | } catch(Exception $e) { |
| 34 | - echo "[-] CreateEnvJob failed" . PHP_EOL; |
|
| 34 | + echo "[-] CreateEnvJob failed".PHP_EOL; |
|
| 35 | 35 | throw $e; |
| 36 | 36 | } |
| 37 | 37 | $this->updateStatus('Finished'); |
| 38 | - echo "[-] CreateEnvJob finished" . PHP_EOL; |
|
| 38 | + echo "[-] CreateEnvJob finished".PHP_EOL; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function perform() { |
| 23 | - echo "[-] DataTransferJob starting" . PHP_EOL; |
|
| 23 | + echo "[-] DataTransferJob starting".PHP_EOL; |
|
| 24 | 24 | $log = new DeploynautLogFile($this->args['logfile']); |
| 25 | 25 | $dataTransfer = DNDataTransfer::get()->byID($this->args['dataTransferID']); |
| 26 | 26 | $environment = $dataTransfer->Environment(); |
@@ -83,12 +83,12 @@ discard block |
||
| 83 | 83 | } catch(RuntimeException $exc) { |
| 84 | 84 | $log->write($exc->getMessage()); |
| 85 | 85 | |
| 86 | - echo "[-] DataTransferJob failed" . PHP_EOL; |
|
| 86 | + echo "[-] DataTransferJob failed".PHP_EOL; |
|
| 87 | 87 | throw $exc; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $this->updateStatus('Finished'); |
| 91 | - echo "[-] DataTransferJob finished" . PHP_EOL; |
|
| 91 | + echo "[-] DataTransferJob finished".PHP_EOL; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -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 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function setEnvironmentDir($environmentDir) { |
| 91 | 91 | if($environmentDir[0] != "/") { |
| 92 | - $environmentDir = BASE_PATH . '/' . $environmentDir; |
|
| 92 | + $environmentDir = BASE_PATH.'/'.$environmentDir; |
|
| 93 | 93 | } |
| 94 | 94 | $this->environmentDir = realpath($environmentDir) ?: $environmentDir; |
| 95 | 95 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function setKeyDir($keyDir) { |
| 112 | 112 | if($keyDir[0] != "/") { |
| 113 | - $keyDir = BASE_PATH . '/' . $keyDir; |
|
| 113 | + $keyDir = BASE_PATH.'/'.$keyDir; |
|
| 114 | 114 | } |
| 115 | 115 | $this->keyDir = realpath($keyDir) ?: $keyDir; |
| 116 | 116 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function setSignalDir($signalDir) { |
| 129 | 129 | if($signalDir[0] != "/") { |
| 130 | - $signalDir = BASE_PATH . '/' . $signalDir; |
|
| 130 | + $signalDir = BASE_PATH.'/'.$signalDir; |
|
| 131 | 131 | } |
| 132 | 132 | $this->signalDir = realpath($signalDir) ?: $signalDir; |
| 133 | 133 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public function setDataTransferDir($transferDir) { |
| 171 | 171 | if($transferDir[0] != "/") { |
| 172 | - $transferDir = BASE_PATH . '/' . $transferDir; |
|
| 172 | + $transferDir = BASE_PATH.'/'.$transferDir; |
|
| 173 | 173 | } |
| 174 | 174 | if(strpos($transferDir, ASSETS_PATH) === false) { |
| 175 | 175 | throw new LogicException(sprintf( |
@@ -199,14 +199,14 @@ discard block |
||
| 199 | 199 | public function getProjectPaths() { |
| 200 | 200 | $paths = array(); |
| 201 | 201 | if(!file_exists($this->getEnvironmentDir())) { |
| 202 | - $eMessage = 'The environment directory ' . $this->getEnvironmentDir() . ' doesn\'t exist. Create it ' |
|
| 202 | + $eMessage = 'The environment directory '.$this->getEnvironmentDir().' doesn\'t exist. Create it ' |
|
| 203 | 203 | . 'first and add some projects to it.'; |
| 204 | 204 | throw new Exception($eMessage); |
| 205 | 205 | } |
| 206 | 206 | foreach(scandir($this->getEnvironmentDir()) as $project) { |
| 207 | 207 | // Exlcude dot-prefixed directories (.git was getting in the way) |
| 208 | 208 | if(preg_match('/^[^\.]/', $project)) { |
| 209 | - $path = $this->getEnvironmentDir() . '/' . $project; |
|
| 209 | + $path = $this->getEnvironmentDir().'/'.$project; |
|
| 210 | 210 | if(is_dir($path) && $project != '.' && $project != '..') { |
| 211 | 211 | $paths[] = $project; |
| 212 | 212 | } |
@@ -221,11 +221,11 @@ discard block |
||
| 221 | 221 | * Returns an array of paths |
| 222 | 222 | */ |
| 223 | 223 | public function getEnvironmentPaths($project) { |
| 224 | - $baseDir = $this->getEnvironmentDir() . '/' . $project; |
|
| 224 | + $baseDir = $this->getEnvironmentDir().'/'.$project; |
|
| 225 | 225 | |
| 226 | 226 | $paths = array(); |
| 227 | 227 | if(!file_exists($baseDir)) { |
| 228 | - throw new Exception('Environment directory ' . $baseDir . ' doesn\'t exist. Create it first.'); |
|
| 228 | + throw new Exception('Environment directory '.$baseDir.' doesn\'t exist. Create it first.'); |
|
| 229 | 229 | } |
| 230 | 230 | // Search the directory for config files. |
| 231 | 231 | foreach(scandir($baseDir) as $environmentFile) { |
@@ -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 | |
@@ -307,10 +307,10 @@ discard block |
||
| 307 | 307 | } |
| 308 | 308 | // Must be logged in to check permissions |
| 309 | 309 | |
| 310 | - if ($this->Usage==='Production' || $this->Usage==='Unspecified') { |
|
| 311 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_DEPLOYMENT, $member)) return true; |
|
| 310 | + if($this->Usage === 'Production' || $this->Usage === 'Unspecified') { |
|
| 311 | + if($this->Project()->allowed(DNRoot::ALLOW_PROD_DEPLOYMENT, $member)) return true; |
|
| 312 | 312 | } else { |
| 313 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_DEPLOYMENT, $member)) return true; |
|
| 313 | + if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_DEPLOYMENT, $member)) return true; |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | return $this->Deployers()->byID($member->ID) |
@@ -342,10 +342,10 @@ discard block |
||
| 342 | 342 | } |
| 343 | 343 | // Must be logged in to check permissions |
| 344 | 344 | |
| 345 | - if ($this->Usage==='Production' || $this->Usage==='Unspecified') { |
|
| 346 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; |
|
| 345 | + if($this->Usage === 'Production' || $this->Usage === 'Unspecified') { |
|
| 346 | + if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; |
|
| 347 | 347 | } else { |
| 348 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; |
|
| 348 | + if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | return $this->CanRestoreMembers()->byID($member->ID) |
@@ -373,10 +373,10 @@ discard block |
||
| 373 | 373 | return false; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - if ($this->Usage==='Production' || $this->Usage==='Unspecified') { |
|
| 377 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; |
|
| 376 | + if($this->Usage === 'Production' || $this->Usage === 'Unspecified') { |
|
| 377 | + if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; |
|
| 378 | 378 | } else { |
| 379 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; |
|
| 379 | + if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | return $this->CanBackupMembers()->byID($member->ID) |
@@ -408,10 +408,10 @@ discard block |
||
| 408 | 408 | } |
| 409 | 409 | // Must be logged in to check permissions |
| 410 | 410 | |
| 411 | - if ($this->Usage==='Production' || $this->Usage==='Unspecified') { |
|
| 412 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; |
|
| 411 | + if($this->Usage === 'Production' || $this->Usage === 'Unspecified') { |
|
| 412 | + if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; |
|
| 413 | 413 | } else { |
| 414 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; |
|
| 414 | + if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | return $this->ArchiveUploaders()->byID($member->ID) |
@@ -434,10 +434,10 @@ discard block |
||
| 434 | 434 | } |
| 435 | 435 | // Must be logged in to check permissions |
| 436 | 436 | |
| 437 | - if ($this->Usage==='Production' || $this->Usage==='Unspecified') { |
|
| 438 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; |
|
| 437 | + if($this->Usage === 'Production' || $this->Usage === 'Unspecified') { |
|
| 438 | + if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; |
|
| 439 | 439 | } else { |
| 440 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; |
|
| 440 | + if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | return $this->ArchiveDownloaders()->byID($member->ID) |
@@ -460,10 +460,10 @@ discard block |
||
| 460 | 460 | } |
| 461 | 461 | // Must be logged in to check permissions |
| 462 | 462 | |
| 463 | - if ($this->Usage==='Production' || $this->Usage==='Unspecified') { |
|
| 464 | - if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; |
|
| 463 | + if($this->Usage === 'Production' || $this->Usage === 'Unspecified') { |
|
| 464 | + if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true; |
|
| 465 | 465 | } else { |
| 466 | - if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; |
|
| 466 | + if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true; |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | return $this->ArchiveDeleters()->byID($member->ID) |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | * @return string |
| 654 | 654 | */ |
| 655 | 655 | public function Link() { |
| 656 | - return $this->Project()->Link() . "/environment/" . $this->Name; |
|
| 656 | + return $this->Project()->Link()."/environment/".$this->Name; |
|
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | /** |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | ->buildPermissionField('ArchiveUploaderGroups', 'ArchiveUploaders', $groups, $members) |
| 799 | 799 | ->setTitle('Who can upload?') |
| 800 | 800 | ->setDescription( |
| 801 | - 'Users who can upload archives linked to this environment into Deploynaut.<br />' . |
|
| 801 | + 'Users who can upload archives linked to this environment into Deploynaut.<br />'. |
|
| 802 | 802 | 'Linking them to an environment allows limiting download permissions (see below).' |
| 803 | 803 | ), |
| 804 | 804 | |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | // Add actions |
| 846 | 846 | $action = new FormAction('check', 'Check Connection'); |
| 847 | 847 | $action->setUseButtonTag(true); |
| 848 | - $dataURL = Director::absoluteBaseURL() . 'naut/api/' . $this->Project()->Name . '/' . $this->Name . '/ping'; |
|
| 848 | + $dataURL = Director::absoluteBaseURL().'naut/api/'.$this->Project()->Name.'/'.$this->Name.'/ping'; |
|
| 849 | 849 | $action->setAttribute('data-url', $dataURL); |
| 850 | 850 | $fields->insertBefore($action, 'Name'); |
| 851 | 851 | |
@@ -882,8 +882,8 @@ discard block |
||
| 882 | 882 | */ |
| 883 | 883 | public function onBeforeWrite() { |
| 884 | 884 | parent::onBeforeWrite(); |
| 885 | - if($this->Name && $this->Name . '.rb' != $this->Filename) { |
|
| 886 | - $this->Filename = $this->Name . '.rb'; |
|
| 885 | + if($this->Name && $this->Name.'.rb' != $this->Filename) { |
|
| 886 | + $this->Filename = $this->Name.'.rb'; |
|
| 887 | 887 | } |
| 888 | 888 | $this->checkEnvironmentPath(); |
| 889 | 889 | $this->writeConfigFile(); |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | && $this->Filename |
| 931 | 931 | && $this->CreateEnvConfig |
| 932 | 932 | ) { |
| 933 | - $templateFile = $this->config()->template_file ?: BASE_PATH . '/deploynaut/environment.template'; |
|
| 933 | + $templateFile = $this->config()->template_file ?: BASE_PATH.'/deploynaut/environment.template'; |
|
| 934 | 934 | file_put_contents($this->getConfigFilename(), file_get_contents($templateFile)); |
| 935 | 935 | } else if($this->envFileExists() && $this->DeployConfig) { |
| 936 | 936 | file_put_contents($this->getConfigFilename(), $this->DeployConfig); |
@@ -985,7 +985,7 @@ discard block |
||
| 985 | 985 | if(!$this->Filename) { |
| 986 | 986 | return ''; |
| 987 | 987 | } |
| 988 | - return $this->DNData()->getEnvironmentDir() . '/' . $this->Project()->Name . '/' . $this->Filename; |
|
| 988 | + return $this->DNData()->getEnvironmentDir().'/'.$this->Project()->Name.'/'.$this->Filename; |
|
| 989 | 989 | } |
| 990 | 990 | |
| 991 | 991 | /** |