Fixing issues when adding a gitlab project

This commit is contained in:
Dan Cryer 2014-04-16 10:14:06 +00:00
parent ad38db47bd
commit 886d79946d

View file

@ -189,11 +189,21 @@ class ProjectController extends \PHPCI\Controller
if ($values['type'] == "gitlab") {
preg_match('`^(.*)@(.*):(.*)/(.*)\.git`', $values['reference'], $matches);
$info = array();
$info["user"] = $matches[1];
$info["domain"] = $matches[2];
if (isset($matches[1])) {
$info["user"] = $matches[1];
}
if (isset($matches[2])) {
$info["domain"] = $matches[2];
}
$values['access_information'] = serialize($info);
$values['reference'] = $matches[3]."/".$matches[4];
if (isset($matches[3]) && isset($matches[4])) {
$values['reference'] = $matches[3]."/".$matches[4];
}
}
$values['git_key'] = $values['key'];