diff --git a/PHPCI/Controller/ProjectController.php b/PHPCI/Controller/ProjectController.php index dcfa312f..76f794c7 100644 --- a/PHPCI/Controller/ProjectController.php +++ b/PHPCI/Controller/ProjectController.php @@ -187,8 +187,8 @@ class ProjectController extends \PHPCI\Controller $values['reference'] = $matches[3]."/".$matches[4]; } - $values['git_key'] = $values['key']; - $values['public_key'] = $values['pubkey']; + $values['ssh_private_key'] = $values['key']; + $values['ssh_public_key'] = $values['pubkey']; $project = new Project(); $project->setValues($values); @@ -218,8 +218,8 @@ class ProjectController extends \PHPCI\Controller $this->config->set('page_title', 'Edit: ' . $project->getTitle()); $values = $project->getDataArray(); - $values['key'] = $values['git_key']; - $values['pubkey'] = $values['public_key']; + $values['key'] = $values['ssh_private_key']; + $values['pubkey'] = $values['ssh_public_key']; if ($values['type'] == "gitlab") { $accessInfo = $project->getAccessInformation(); @@ -244,8 +244,8 @@ class ProjectController extends \PHPCI\Controller } $values = $form->getValues(); - $values['git_key'] = $values['key']; - $values['public_key'] = $values['pubkey']; + $values['ssh_private_key'] = $values['key']; + $values['ssh_public_key'] = $values['pubkey']; if ($values['type'] == "gitlab") { preg_match('`^(.*)@(.*):(.*)/(.*)\.git`', $values['reference'], $matches); diff --git a/PHPCI/Migrations/20140513153133_change_build_keys_migration.php b/PHPCI/Migrations/20140513153133_change_build_keys_migration.php new file mode 100644 index 00000000..b26a9388 --- /dev/null +++ b/PHPCI/Migrations/20140513153133_change_build_keys_migration.php @@ -0,0 +1,26 @@ +table('project'); + $project->renameColumn('git_key', 'ssh_private_key'); + $project->renameColumn('public_key', 'ssh_public_key'); + } + + /** + * Migrate Down. + */ + public function down() + { + $project = $this->table('project'); + $project->renameColumn('ssh_private_key', 'git_key'); + $project->renameColumn('ssh_public_key', 'public_key'); + } +} \ No newline at end of file diff --git a/PHPCI/Model/Build/BitbucketBuild.php b/PHPCI/Model/Build/BitbucketBuild.php index 5d7539b3..3af0d2b5 100644 --- a/PHPCI/Model/Build/BitbucketBuild.php +++ b/PHPCI/Model/Build/BitbucketBuild.php @@ -41,7 +41,7 @@ class BitbucketBuild extends RemoteGitBuild */ protected function getCloneUrl() { - $key = trim($this->getProject()->getGitKey()); + $key = trim($this->getProject()->getSshPrivateKey()); if (!empty($key)) { return 'git@bitbucket.org:' . $this->getProject()->getReference() . '.git'; diff --git a/PHPCI/Model/Build/GithubBuild.php b/PHPCI/Model/Build/GithubBuild.php index 281dfc22..6d3f217b 100644 --- a/PHPCI/Model/Build/GithubBuild.php +++ b/PHPCI/Model/Build/GithubBuild.php @@ -86,7 +86,7 @@ class GithubBuild extends RemoteGitBuild */ protected function getCloneUrl() { - $key = trim($this->getProject()->getGitKey()); + $key = trim($this->getProject()->getSshPrivateKey()); if (!empty($key)) { return 'git@github.com:' . $this->getProject()->getReference() . '.git'; diff --git a/PHPCI/Model/Build/GitlabBuild.php b/PHPCI/Model/Build/GitlabBuild.php index beaf6f1e..83053090 100644 --- a/PHPCI/Model/Build/GitlabBuild.php +++ b/PHPCI/Model/Build/GitlabBuild.php @@ -56,7 +56,7 @@ class GitlabBuild extends RemoteGitBuild */ protected function getCloneUrl() { - $key = trim($this->getProject()->getGitKey()); + $key = trim($this->getProject()->getSshPrivateKey()); if (!empty($key)) { $user = $this->getProject()->getAccessInformation("user"); diff --git a/PHPCI/Model/Build/RemoteGitBuild.php b/PHPCI/Model/Build/RemoteGitBuild.php index 6f845ba7..2af3f584 100644 --- a/PHPCI/Model/Build/RemoteGitBuild.php +++ b/PHPCI/Model/Build/RemoteGitBuild.php @@ -33,7 +33,7 @@ class RemoteGitBuild extends Build */ public function createWorkingCopy(Builder $builder, $buildPath) { - $key = trim($this->getProject()->getGitKey()); + $key = trim($this->getProject()->getSshPrivateKey()); if (!empty($key)) { $success = $this->cloneBySsh($builder, $buildPath); @@ -140,7 +140,7 @@ class RemoteGitBuild extends Build $keyFile = $keyPath . '.key'; // Write the contents of this project's git key to the file: - file_put_contents($keyFile, $this->getProject()->getGitKey()); + file_put_contents($keyFile, $this->getProject()->getSshPrivateKey()); chmod($keyFile, 0600); // Return the filename: