Renaming project.git_key and project.public_key to project.ssh_private_key and project.ssh_public_key respectively.

This commit is contained in:
Dan Cryer 2014-05-13 15:15:33 +00:00
parent d63a029b74
commit ba8d88f233
6 changed files with 37 additions and 11 deletions

View file

@ -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);

View file

@ -0,0 +1,26 @@
<?php
use Phinx\Migration\AbstractMigration;
class ChangeBuildKeysMigration extends AbstractMigration
{
/**
* Migrate Up.
*/
public function up()
{
$project = $this->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');
}
}

View file

@ -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';

View file

@ -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';

View file

@ -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");

View file

@ -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: