@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | public function LogLink() { |
| 111 | - return $this->Link() . '/log'; |
|
| 111 | + return $this->Link().'/log'; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | public function canView($member = null) { |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @return \Gitonomy\Git\Repository|null |
| 155 | 155 | */ |
| 156 | 156 | public function getRepository() { |
| 157 | - if(!$this->SHA) { |
|
| 157 | + if (!$this->SHA) { |
|
| 158 | 158 | return null; |
| 159 | 159 | } |
| 160 | 160 | return $this->Environment()->Project()->getRepository(); |
@@ -167,10 +167,10 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function getCommit() { |
| 169 | 169 | $repo = $this->getRepository(); |
| 170 | - if($repo) { |
|
| 170 | + if ($repo) { |
|
| 171 | 171 | try { |
| 172 | 172 | return $this->Environment()->getCommit($this->SHA); |
| 173 | - } catch(Gitonomy\Git\Exception\ReferenceNotFoundException $ex) { |
|
| 173 | + } catch (Gitonomy\Git\Exception\ReferenceNotFoundException $ex) { |
|
| 174 | 174 | return null; |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | if (!$interface) { |
| 196 | 196 | return null; |
| 197 | 197 | } |
| 198 | - return $interface->CommitURL . '/' . $this->SHA; |
|
| 198 | + return $interface->CommitURL.'/'.$this->SHA; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -205,10 +205,10 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function getCommitMessage() { |
| 207 | 207 | $commit = $this->getCommit(); |
| 208 | - if($commit) { |
|
| 208 | + if ($commit) { |
|
| 209 | 209 | try { |
| 210 | 210 | return Convert::raw2xml($this->Environment()->getCommitMessage($commit)); |
| 211 | - } catch(Gitonomy\Git\Exception\ReferenceNotFoundException $e) { |
|
| 211 | + } catch (Gitonomy\Git\Exception\ReferenceNotFoundException $e) { |
|
| 212 | 212 | return null; |
| 213 | 213 | } |
| 214 | 214 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $this->Environment()->getCommitTags($commit); |
| 226 | 226 | $returnTags = []; |
| 227 | 227 | if (!empty($tags)) { |
| 228 | - foreach($tags as $tag) { |
|
| 228 | + foreach ($tags as $tag) { |
|
| 229 | 229 | $field = Varchar::create('Tag', '255'); |
| 230 | 230 | $field->setValue($tag->getName()); |
| 231 | 231 | $returnTags[] = $field; |
@@ -242,12 +242,12 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | public function getFullDeployMessages() { |
| 244 | 244 | $strategy = $this->getDeploymentStrategy(); |
| 245 | - if ($strategy->getActionCode()!=='full') return null; |
|
| 245 | + if ($strategy->getActionCode() !== 'full') return null; |
|
| 246 | 246 | |
| 247 | 247 | $changes = $strategy->getChangesModificationNeeded(); |
| 248 | 248 | $messages = []; |
| 249 | 249 | foreach ($changes as $change => $details) { |
| 250 | - if ($change==='Code version') continue; |
|
| 250 | + if ($change === 'Code version') continue; |
|
| 251 | 251 | |
| 252 | 252 | $messages[] = [ |
| 253 | 253 | 'Flag' => sprintf( |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | public function getTag() { |
| 277 | 277 | $tags = $this->getTags(); |
| 278 | - if($tags->count() > 0) { |
|
| 278 | + if ($tags->count() > 0) { |
|
| 279 | 279 | return $tags->last(); |
| 280 | 280 | } |
| 281 | 281 | return null; |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | public function getChanges() { |
| 301 | 301 | $list = new ArrayList(); |
| 302 | 302 | $strategy = $this->getDeploymentStrategy(); |
| 303 | - foreach($strategy->getChanges() as $name => $change) { |
|
| 303 | + foreach ($strategy->getChanges() as $name => $change) { |
|
| 304 | 304 | $changed = (isset($change['from']) && isset($change['to'])) ? $change['from'] != $change['to'] : null; |
| 305 | 305 | $description = isset($change['description']) ? $change['description'] : ''; |
| 306 | 306 | $compareUrl = null; |
@@ -350,11 +350,11 @@ discard block |
||
| 350 | 350 | // Make sure we use the SHA as it was written into this DNDeployment. |
| 351 | 351 | $args['sha'] = $this->SHA; |
| 352 | 352 | |
| 353 | - if(!$this->DeployerID) { |
|
| 353 | + if (!$this->DeployerID) { |
|
| 354 | 354 | $this->DeployerID = Member::currentUserID(); |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - if($this->DeployerID) { |
|
| 357 | + if ($this->DeployerID) { |
|
| 358 | 358 | $deployer = $this->Deployer(); |
| 359 | 359 | $message = sprintf( |
| 360 | 360 | 'Deploy to %s initiated by %s (%s), with IP address %s', |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | protected function getUpdateStatus($ID) { |
| 169 | 169 | $ping = DNGitFetch::get()->byID($ID); |
| 170 | 170 | if (!$ping) { |
| 171 | - return $this->getAPIResponse(['message' => 'GIT update (' . $ID . ') not found'], 404); |
|
| 171 | + return $this->getAPIResponse(['message' => 'GIT update ('.$ID.') not found'], 404); |
|
| 172 | 172 | } |
| 173 | 173 | $output = [ |
| 174 | 174 | 'id' => $ID, |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $fetch->write(); |
| 190 | 190 | $fetch->start(); |
| 191 | 191 | |
| 192 | - $location = Director::absoluteBaseURL() . $this->Link() . '/update/' . $fetch->ID; |
|
| 192 | + $location = Director::absoluteBaseURL().$this->Link().'/update/'.$fetch->ID; |
|
| 193 | 193 | $output = [ |
| 194 | 194 | 'message' => 'git fetch has been queued', |
| 195 | 195 | 'id' => $fetch->ID, |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $commit = $this->project->getCommit($branch->SHA()); |
| 213 | 213 | $branches[] = [ |
| 214 | 214 | 'key' => $branch->SHA(), |
| 215 | - 'value' => $branch->Name() . ' (' . $this->project->getCommitMessage($commit) . ')', |
|
| 215 | + 'value' => $branch->Name().' ('.$this->project->getCommitMessage($commit).')', |
|
| 216 | 216 | ]; |
| 217 | 217 | } |
| 218 | 218 | return $branches; |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $cache = self::get_git_cache(); |
| 161 | 161 | // we only need to clear the tag cache since everything else is cached by SHA, that is for commit and |
| 162 | 162 | // commit message. |
| 163 | - $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, ['gitonomy', 'tags', 'project_' . $this->ID]); |
|
| 163 | + $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, ['gitonomy', 'tags', 'project_'.$this->ID]); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | return true; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - return (bool) $this->Environments()->filterByCallback(function ($env) use ($member) { |
|
| 334 | + return (bool) $this->Environments()->filterByCallback(function($env) use ($member) { |
|
| 335 | 335 | return $env->canRestore($member); |
| 336 | 336 | })->Count(); |
| 337 | 337 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | return true; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - return (bool) $this->Environments()->filterByCallback(function ($env) use ($member) { |
|
| 355 | + return (bool) $this->Environments()->filterByCallback(function($env) use ($member) { |
|
| 356 | 356 | return $env->canBackup($member); |
| 357 | 357 | })->Count(); |
| 358 | 358 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | return true; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - return (bool) $this->Environments()->filterByCallback(function ($env) use ($member) { |
|
| 376 | + return (bool) $this->Environments()->filterByCallback(function($env) use ($member) { |
|
| 377 | 377 | return $env->canUploadArchive($member); |
| 378 | 378 | })->Count(); |
| 379 | 379 | } |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | return true; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - return (bool) $this->Environments()->filterByCallback(function ($env) use ($member) { |
|
| 397 | + return (bool) $this->Environments()->filterByCallback(function($env) use ($member) { |
|
| 398 | 398 | return $env->canDownloadArchive($member); |
| 399 | 399 | })->Count(); |
| 400 | 400 | } |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | // Key-pair is available, use it. |
| 454 | 454 | $processEnv = [ |
| 455 | 455 | 'IDENT_KEY' => $this->getPrivateKeyPath(), |
| 456 | - 'GIT_SSH' => BASE_PATH . "/deploynaut/git-deploy.sh" |
|
| 456 | + 'GIT_SSH' => BASE_PATH."/deploynaut/git-deploy.sh" |
|
| 457 | 457 | ]; |
| 458 | 458 | } else { |
| 459 | 459 | $processEnv = []; |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | |
| 542 | 542 | $currentMember = self::$_current_member_cache; |
| 543 | 543 | return $this->Environments() |
| 544 | - ->filterByCallBack(function ($item) use ($currentMember) { |
|
| 544 | + ->filterByCallBack(function($item) use ($currentMember) { |
|
| 545 | 545 | return $item->canView($currentMember); |
| 546 | 546 | }); |
| 547 | 547 | } |
@@ -560,14 +560,14 @@ discard block |
||
| 560 | 560 | * @return false|DNDeployment |
| 561 | 561 | */ |
| 562 | 562 | public function currentBuilds() { |
| 563 | - if (!isset(self::$relation_cache['currentBuilds.' . $this->ID])) { |
|
| 563 | + if (!isset(self::$relation_cache['currentBuilds.'.$this->ID])) { |
|
| 564 | 564 | $currentBuilds = []; |
| 565 | 565 | foreach ($this->Environments() as $env) { |
| 566 | 566 | $currentBuilds[$env->Name] = $env->CurrentBuild(); |
| 567 | 567 | } |
| 568 | - self::$relation_cache['currentBuilds.' . $this->ID] = $currentBuilds; |
|
| 568 | + self::$relation_cache['currentBuilds.'.$this->ID] = $currentBuilds; |
|
| 569 | 569 | } |
| 570 | - return self::$relation_cache['currentBuilds.' . $this->ID]; |
|
| 570 | + return self::$relation_cache['currentBuilds.'.$this->ID]; |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | /** |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | */ |
| 809 | 809 | public function getPublicKeyPath() { |
| 810 | 810 | if ($privateKey = $this->getPrivateKeyPath()) { |
| 811 | - return $privateKey . '.pub'; |
|
| 811 | + return $privateKey.'.pub'; |
|
| 812 | 812 | } |
| 813 | 813 | return null; |
| 814 | 814 | } |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | if (!empty($keyDir)) { |
| 824 | 824 | $filter = FileNameFilter::create(); |
| 825 | 825 | $name = $filter->filter($this->Name); |
| 826 | - return $keyDir . '/' . $name; |
|
| 826 | + return $keyDir.'/'.$name; |
|
| 827 | 827 | } |
| 828 | 828 | return null; |
| 829 | 829 | } |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | $filter = FileNameFilter::create(); |
| 843 | 843 | $name = $filter->filter($this->Name); |
| 844 | 844 | |
| 845 | - return $this->DNData()->getKeyDir() . '/' . $name; |
|
| 845 | + return $this->DNData()->getKeyDir().'/'.$name; |
|
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | /** |
@@ -868,7 +868,7 @@ discard block |
||
| 868 | 868 | /* Look for each whitelisted hostname */ |
| 869 | 869 | foreach ($interfaces as $host => $interface) { |
| 870 | 870 | /* See if the CVS Path is for this hostname, followed by some junk (maybe a port), then the path */ |
| 871 | - if (preg_match('{^[^.]*' . $host . '(.*?)([/a-zA-Z].+)}', $this->CVSPath, $match)) { |
|
| 871 | + if (preg_match('{^[^.]*'.$host.'(.*?)([/a-zA-Z].+)}', $this->CVSPath, $match)) { |
|
| 872 | 872 | |
| 873 | 873 | $path = $match[2]; |
| 874 | 874 | |
@@ -879,10 +879,10 @@ discard block |
||
| 879 | 879 | $components = explode('.', $host); |
| 880 | 880 | |
| 881 | 881 | foreach ($regex as $pattern => $replacement) { |
| 882 | - $path = preg_replace('/' . $pattern . '/', $replacement, $path); |
|
| 882 | + $path = preg_replace('/'.$pattern.'/', $replacement, $path); |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | - $uxurl = Controller::join_links($scheme . '://', $host, $path); |
|
| 885 | + $uxurl = Controller::join_links($scheme.'://', $host, $path); |
|
| 886 | 886 | |
| 887 | 887 | if (array_key_exists('commit', $interface) && $interface['commit'] == false) { |
| 888 | 888 | $commiturl = false; |
@@ -1009,7 +1009,7 @@ discard block |
||
| 1009 | 1009 | // {@see DataObject::extendedCan()} |
| 1010 | 1010 | $isDone = $this->extend('isProjectReady'); |
| 1011 | 1011 | if ($isDone && is_array($isDone)) { |
| 1012 | - $isDone = array_filter($isDone, function ($val) { |
|
| 1012 | + $isDone = array_filter($isDone, function($val) { |
|
| 1013 | 1013 | return !is_null($val); |
| 1014 | 1014 | }); |
| 1015 | 1015 | |
@@ -1094,11 +1094,11 @@ discard block |
||
| 1094 | 1094 | return false; |
| 1095 | 1095 | } |
| 1096 | 1096 | |
| 1097 | - $cachekey = $this->ID . '_commit_' . $sha; |
|
| 1097 | + $cachekey = $this->ID.'_commit_'.$sha; |
|
| 1098 | 1098 | $cache = self::get_git_cache(); |
| 1099 | 1099 | if (!($result = $cache->load($cachekey))) { |
| 1100 | 1100 | $result = $repo->getCommit($sha); |
| 1101 | - $cache->save($result, $cachekey, ['gitonomy', 'commit', 'project_' . $this->ID]); |
|
| 1101 | + $cache->save($result, $cachekey, ['gitonomy', 'commit', 'project_'.$this->ID]); |
|
| 1102 | 1102 | } |
| 1103 | 1103 | return $result; |
| 1104 | 1104 | } |
@@ -1108,11 +1108,11 @@ discard block |
||
| 1108 | 1108 | * @return string |
| 1109 | 1109 | */ |
| 1110 | 1110 | public function getCommitMessage(\Gitonomy\Git\Commit $commit) { |
| 1111 | - $cachekey = $this->ID . '_message_' . $commit->getRevision(); |
|
| 1111 | + $cachekey = $this->ID.'_message_'.$commit->getRevision(); |
|
| 1112 | 1112 | $cache = self::get_git_cache(); |
| 1113 | 1113 | if (!($result = $cache->load($cachekey))) { |
| 1114 | 1114 | $result = $commit->getMessage(); |
| 1115 | - $cache->save($result, $cachekey, ['gitonomy', 'message', 'project_' . $this->ID]); |
|
| 1115 | + $cache->save($result, $cachekey, ['gitonomy', 'message', 'project_'.$this->ID]); |
|
| 1116 | 1116 | } |
| 1117 | 1117 | return $result; |
| 1118 | 1118 | } |
@@ -1122,14 +1122,14 @@ discard block |
||
| 1122 | 1122 | * @return mixed |
| 1123 | 1123 | */ |
| 1124 | 1124 | public function getCommitTags(\Gitonomy\Git\Commit $commit) { |
| 1125 | - $cachekey = $this->ID . '_tags_' . $commit->getRevision(); |
|
| 1125 | + $cachekey = $this->ID.'_tags_'.$commit->getRevision(); |
|
| 1126 | 1126 | $cache = self::get_git_cache(); |
| 1127 | 1127 | $result = $cache->load($cachekey); |
| 1128 | 1128 | // we check against false, because in many cases the tag list is an empty array |
| 1129 | 1129 | if ($result === false) { |
| 1130 | 1130 | $repo = $this->getRepository(); |
| 1131 | 1131 | $result = $tags = $repo->getReferences()->resolveTags($commit->getRevision()); |
| 1132 | - $cache->save($result, $cachekey, ['gitonomy', 'tags', 'project_' . $this->ID]); |
|
| 1132 | + $cache->save($result, $cachekey, ['gitonomy', 'tags', 'project_'.$this->ID]); |
|
| 1133 | 1133 | } |
| 1134 | 1134 | return $result; |
| 1135 | 1135 | } |