@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | if($dryRun) { |
21 | 21 | echo "Running in dry run mode, no changes commited, "; |
22 | - echo "the output shows a prediction on what will happen." . PHP_EOL; |
|
23 | - echo "To skip dryrun, run the task like this:" . PHP_EOL; |
|
24 | - echo "./framework/sake dev/tasks/SyncProjectsAndEnvironments dryrun=0" . PHP_EOL . PHP_EOL; |
|
22 | + echo "the output shows a prediction on what will happen.".PHP_EOL; |
|
23 | + echo "To skip dryrun, run the task like this:".PHP_EOL; |
|
24 | + echo "./framework/sake dev/tasks/SyncProjectsAndEnvironments dryrun=0".PHP_EOL.PHP_EOL; |
|
25 | 25 | sleep(3); |
26 | 26 | } |
27 | 27 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | foreach($removeList as $remove) { |
70 | - $this->message('Removing "' . basename($remove->Name) . '" from db'); |
|
70 | + $this->message('Removing "'.basename($remove->Name).'" from db'); |
|
71 | 71 | if(!$dryRun) { |
72 | 72 | $removeList->remove($remove); |
73 | 73 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | foreach($removeList as $remove) { |
91 | - $this->message($remove->Name . ' ' . $remove->Path); |
|
91 | + $this->message($remove->Name.' '.$remove->Path); |
|
92 | 92 | if(!$dryrun) { |
93 | 93 | $removeList->remove($remove); |
94 | 94 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | continue; |
121 | 121 | } |
122 | 122 | |
123 | - $this->message('Adding "' . basename($path) . '" to db'); |
|
123 | + $this->message('Adding "'.basename($path).'" to db'); |
|
124 | 124 | if(!$dryRun) { |
125 | 125 | $environment = DNEnvironment::create_from_path($path); |
126 | 126 | $environment->ProjectID = $project->ID; |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | */ |
152 | 152 | protected function message($text) { |
153 | 153 | if(PHP_SAPI !== 'cli') { |
154 | - $text = '<p>' . $text . '</p>' . PHP_EOL; |
|
154 | + $text = '<p>'.$text.'</p>'.PHP_EOL; |
|
155 | 155 | } |
156 | - echo ' - ' . $text . PHP_EOL; |
|
156 | + echo ' - '.$text.PHP_EOL; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | */ |
162 | 162 | protected function echoHeader($text) { |
163 | 163 | if(PHP_SAPI !== 'cli') { |
164 | - echo '<h2>' . $text . '</h2>' . PHP_EOL; |
|
164 | + echo '<h2>'.$text.'</h2>'.PHP_EOL; |
|
165 | 165 | } else { |
166 | - echo '# ' . $text . PHP_EOL; |
|
166 | + echo '# '.$text.PHP_EOL; |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | } |
@@ -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 | /** |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | public function perform() { |
19 | - echo "[-] DeployJob starting" . PHP_EOL; |
|
19 | + echo "[-] DeployJob starting".PHP_EOL; |
|
20 | 20 | $log = new DeploynautLogFile($this->args['logfile']); |
21 | 21 | |
22 | 22 | $deployment = DNDeployment::get()->byID($this->args['deploymentID']); |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | $this->args |
51 | 51 | ); |
52 | 52 | } catch(Exception $e) { |
53 | - echo "[-] DeployJob failed" . PHP_EOL; |
|
53 | + echo "[-] DeployJob failed".PHP_EOL; |
|
54 | 54 | throw $e; |
55 | 55 | } |
56 | 56 | $this->updateStatus('Finished'); |
57 | - echo "[-] DeployJob finished" . PHP_EOL; |
|
57 | + echo "[-] DeployJob finished".PHP_EOL; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -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']); |
@@ -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 | /** |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | } |
446 | 446 | |
447 | 447 | /** |
448 | - * @return false|Gitonomy\Git\Repository |
|
448 | + * @return Gitonomy\Git\Repository |
|
449 | 449 | */ |
450 | 450 | public function getRepository() { |
451 | 451 | if(!$this->repoExists()) { |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | /** |
954 | 954 | * Check if member has a permission code in this project. |
955 | 955 | * |
956 | - * @param string $code |
|
956 | + * @param string $codes |
|
957 | 957 | * @param Member|null $member |
958 | 958 | * |
959 | 959 | * @return bool |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @return bool |
257 | 257 | */ |
258 | 258 | public function canRestore($member = null) { |
259 | - if ($this->allowedAny( |
|
259 | + if($this->allowedAny( |
|
260 | 260 | array( |
261 | 261 | DNRoot::ALLOW_PROD_SNAPSHOT, |
262 | 262 | DNRoot::ALLOW_NON_PROD_SNAPSHOT |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @return bool |
277 | 277 | */ |
278 | 278 | public function canBackup($member = null) { |
279 | - if ($this->allowedAny( |
|
279 | + if($this->allowedAny( |
|
280 | 280 | array( |
281 | 281 | DNRoot::ALLOW_PROD_SNAPSHOT, |
282 | 282 | DNRoot::ALLOW_NON_PROD_SNAPSHOT |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * @return bool |
297 | 297 | */ |
298 | 298 | public function canUploadArchive($member = null) { |
299 | - if ($this->allowedAny( |
|
299 | + if($this->allowedAny( |
|
300 | 300 | array( |
301 | 301 | DNRoot::ALLOW_PROD_SNAPSHOT, |
302 | 302 | DNRoot::ALLOW_NON_PROD_SNAPSHOT |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * @return bool |
317 | 317 | */ |
318 | 318 | public function canDownloadArchive($member = null) { |
319 | - if ($this->allowedAny( |
|
319 | + if($this->allowedAny( |
|
320 | 320 | array( |
321 | 321 | DNRoot::ALLOW_PROD_SNAPSHOT, |
322 | 322 | DNRoot::ALLOW_NON_PROD_SNAPSHOT |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | // Key-pair is available, use it. |
386 | 386 | $processEnv = array( |
387 | 387 | 'IDENT_KEY' => $this->getPrivateKeyPath(), |
388 | - 'GIT_SSH' => BASE_PATH . "/deploynaut/git-deploy.sh" |
|
388 | + 'GIT_SSH' => BASE_PATH."/deploynaut/git-deploy.sh" |
|
389 | 389 | ); |
390 | 390 | } else { |
391 | 391 | $processEnv = array(); |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * @return bool |
647 | 647 | */ |
648 | 648 | public function repoExists() { |
649 | - return file_exists(DEPLOYNAUT_LOCAL_VCS_PATH . '/' . $this->Name.'/HEAD'); |
|
649 | + return file_exists(DEPLOYNAUT_LOCAL_VCS_PATH.'/'.$this->Name.'/HEAD'); |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | /** |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | * @return string |
665 | 665 | */ |
666 | 666 | public function getLocalCVSPath() { |
667 | - return DEPLOYNAUT_LOCAL_VCS_PATH . '/' . $this->Name; |
|
667 | + return DEPLOYNAUT_LOCAL_VCS_PATH.'/'.$this->Name; |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | /** |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | */ |
741 | 741 | public function getPublicKeyPath() { |
742 | 742 | if($privateKey = $this->getPrivateKeyPath()) { |
743 | - return $privateKey . '.pub'; |
|
743 | + return $privateKey.'.pub'; |
|
744 | 744 | } |
745 | 745 | return null; |
746 | 746 | } |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | if(!empty($keyDir)) { |
756 | 756 | $filter = FileNameFilter::create(); |
757 | 757 | $name = $filter->filter($this->Name); |
758 | - return $keyDir . '/' . $name; |
|
758 | + return $keyDir.'/'.$name; |
|
759 | 759 | } |
760 | 760 | return null; |
761 | 761 | } |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | $filter = FileNameFilter::create(); |
775 | 775 | $name = $filter->filter($this->Name); |
776 | 776 | |
777 | - return $this->DNData()->getKeyDir() . '/' . $name; |
|
777 | + return $this->DNData()->getKeyDir().'/'.$name; |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | /** |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | /* Look for each whitelisted hostname */ |
862 | 862 | foreach($interfaces as $host => $interface) { |
863 | 863 | /* See if the CVS Path is for this hostname, followed by some junk (maybe a port), then the path */ |
864 | - if(preg_match('{^[^.]*' . $host . '(.*?)([/a-zA-Z].+)}', $this->CVSPath, $match)) { |
|
864 | + if(preg_match('{^[^.]*'.$host.'(.*?)([/a-zA-Z].+)}', $this->CVSPath, $match)) { |
|
865 | 865 | |
866 | 866 | $path = $match[2]; |
867 | 867 | |
@@ -872,10 +872,10 @@ discard block |
||
872 | 872 | $components = explode('.', $host); |
873 | 873 | |
874 | 874 | foreach($regex as $pattern => $replacement) { |
875 | - $path = preg_replace('/' . $pattern . '/', $replacement, $path); |
|
875 | + $path = preg_replace('/'.$pattern.'/', $replacement, $path); |
|
876 | 876 | } |
877 | 877 | |
878 | - $uxurl = Controller::join_links($scheme . '://', $host, $path); |
|
878 | + $uxurl = Controller::join_links($scheme.'://', $host, $path); |
|
879 | 879 | |
880 | 880 | if(array_key_exists('commit', $interface) && $interface['commit'] == false) { |
881 | 881 | $commiturl = false; |
@@ -959,14 +959,14 @@ discard block |
||
959 | 959 | * @return bool |
960 | 960 | */ |
961 | 961 | public function allowedAny($codes, $member = null) { |
962 | - if (!$member) { |
|
962 | + if(!$member) { |
|
963 | 963 | $member = Member::currentUser(); |
964 | 964 | } |
965 | 965 | |
966 | 966 | if(Permission::checkMember($member, 'ADMIN')) return true; |
967 | 967 | |
968 | 968 | $hits = $this->whoIsAllowedAny($codes)->filter('Member.ID', $member->ID)->count(); |
969 | - return ($hits>0 ? true : false); |
|
969 | + return ($hits > 0 ? true : false); |
|
970 | 970 | } |
971 | 971 | |
972 | 972 | } |
@@ -921,7 +921,9 @@ discard block |
||
921 | 921 | * @return SS_List |
922 | 922 | */ |
923 | 923 | public function whoIsAllowedAny($codes) { |
924 | - if(!is_array($codes)) $codes = array($codes); |
|
924 | + if(!is_array($codes)) { |
|
925 | + $codes = array($codes); |
|
926 | + } |
|
925 | 927 | |
926 | 928 | $SQLa_codes = Convert::raw2sql($codes); |
927 | 929 | $SQL_codes = join("','", $SQLa_codes); |
@@ -963,7 +965,9 @@ discard block |
||
963 | 965 | $member = Member::currentUser(); |
964 | 966 | } |
965 | 967 | |
966 | - if(Permission::checkMember($member, 'ADMIN')) return true; |
|
968 | + if(Permission::checkMember($member, 'ADMIN')) { |
|
969 | + return true; |
|
970 | + } |
|
967 | 971 | |
968 | 972 | $hits = $this->whoIsAllowedAny($codes)->filter('Member.ID', $member->ID)->count(); |
969 | 973 | return ($hits>0 ? true : false); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $path = $this->args['path']; |
19 | 19 | $repo = $this->args['repo']; |
20 | 20 | $env = $this->args['env']; |
21 | - $logfile = DEPLOYNAUT_LOG_PATH . '/clonegitrepo.log'; |
|
21 | + $logfile = DEPLOYNAUT_LOG_PATH.'/clonegitrepo.log'; |
|
22 | 22 | $fh = fopen($logfile, 'a'); |
23 | 23 | if(!$fh) { |
24 | 24 | throw new RuntimeException(sprintf('Can\'t open file "%s" for logging.', $logfile)); |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | } |
35 | 35 | $command[] = sprintf('rm -rf %s', $path); |
36 | 36 | |
37 | - fwrite($fh, sprintf('[%s] Cleaning up existing repository %s', date('Y-m-d H:i:s'), $path) . PHP_EOL); |
|
38 | - fwrite($fh, sprintf('[%s] Running command: %s', date('Y-m-d H:i:s'), implode(' ', $command)) . PHP_EOL); |
|
37 | + fwrite($fh, sprintf('[%s] Cleaning up existing repository %s', date('Y-m-d H:i:s'), $path).PHP_EOL); |
|
38 | + fwrite($fh, sprintf('[%s] Running command: %s', date('Y-m-d H:i:s'), implode(' ', $command)).PHP_EOL); |
|
39 | 39 | |
40 | 40 | $process = new \Symfony\Component\Process\Process(implode(' ', $command)); |
41 | 41 | $process->setEnv($env); |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | '[%s] Error cleaning up existing repository: %s', |
47 | 47 | date('Y-m-d H:i:s'), |
48 | 48 | $process->getErrorOutput() |
49 | - ) . PHP_EOL); |
|
49 | + ).PHP_EOL); |
|
50 | 50 | throw new RuntimeException($process->getErrorOutput()); |
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | - fwrite($fh, sprintf('[%s] Cloning repository %s to %s', date('Y-m-d H:i:s'), $repo, $path) . PHP_EOL); |
|
55 | - echo "[-] CloneGitRepo starting" . PHP_EOL; |
|
54 | + fwrite($fh, sprintf('[%s] Cloning repository %s to %s', date('Y-m-d H:i:s'), $repo, $path).PHP_EOL); |
|
55 | + echo "[-] CloneGitRepo starting".PHP_EOL; |
|
56 | 56 | |
57 | 57 | $command = array(); |
58 | 58 | if(!empty($user)) { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | $command[] = sprintf('git clone --bare -q %s %s', $repo, $path); |
62 | 62 | |
63 | - fwrite($fh, sprintf('[%s] Running command: %s', date('Y-m-d H:i:s'), implode(' ', $command)) . PHP_EOL); |
|
63 | + fwrite($fh, sprintf('[%s] Running command: %s', date('Y-m-d H:i:s'), implode(' ', $command)).PHP_EOL); |
|
64 | 64 | |
65 | 65 | $process = new \Symfony\Component\Process\Process(implode(' ', $command)); |
66 | 66 | $process->setEnv($env); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $repo, |
74 | 74 | $path, |
75 | 75 | $process->getErrorOutput() |
76 | - ) . PHP_EOL); |
|
76 | + ).PHP_EOL); |
|
77 | 77 | throw new RuntimeException($process->getErrorOutput()); |
78 | 78 | } |
79 | 79 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | date('Y-m-d H:i:s'), |
83 | 83 | $repo, |
84 | 84 | $path |
85 | - ) . PHP_EOL); |
|
85 | + ).PHP_EOL); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | $path = $project->getLocalCVSPath(); |
24 | 24 | $env = $this->args['env']; |
25 | 25 | |
26 | - $log->write('Starting git fetch for project "' . $project->Name . '"'); |
|
26 | + $log->write('Starting git fetch for project "'.$project->Name.'"'); |
|
27 | 27 | |
28 | 28 | // if an alternate user has been configured for clone, run the command as that user |
29 | 29 | // @todo Gitonomy doesn't seem to have any way to prefix the command properly, if you |