From: Christian Weiske Date: Fri, 13 Jun 2014 09:29:09 +0000 (+0200) Subject: handle undefined local clone urls X-Git-Tag: v0.4.0~28^2~2 X-Git-Url: https://git.cweiske.de/phorkie.git/commitdiff_plain/94b076f028c2a12f522887caf02b6289957cf4fe?hp=d80854dc9a670e0ee996cc89a59af2c5f8521205 handle undefined local clone urls --- diff --git a/src/phorkie/Repository/LinkbackReceiver.php b/src/phorkie/Repository/LinkbackReceiver.php index c9b3d03..c808f45 100644 --- a/src/phorkie/Repository/LinkbackReceiver.php +++ b/src/phorkie/Repository/LinkbackReceiver.php @@ -120,13 +120,19 @@ class Repository_LinkbackReceiver */ protected function localizeGitUrls($arGitUrls) { - $pub = $GLOBALS['phorkie']['cfg']['git']['public']; - $pri = $GLOBALS['phorkie']['cfg']['git']['private']; + $pub = $pri = null; + if (isset($GLOBALS['phorkie']['cfg']['git']['public'])) { + $pub = $GLOBALS['phorkie']['cfg']['git']['public']; + } + if (isset($GLOBALS['phorkie']['cfg']['git']['private'])) { + $pri = $GLOBALS['phorkie']['cfg']['git']['private']; + } $arRemoteCloneUrls = array(); foreach ($arGitUrls as $remoteTitle => $arUrls) { foreach ($arUrls as $remoteCloneUrl) { - if (substr($remoteCloneUrl, 0, strlen($pub)) == $pub + if ($pub !== null + && substr($remoteCloneUrl, 0, strlen($pub)) == $pub && substr($remoteCloneUrl, -4) == '.git' ) { $id = substr($remoteCloneUrl, strlen($pub), -4); @@ -136,7 +142,8 @@ class Repository_LinkbackReceiver $arRemoteCloneUrls[$repo->gitDir] = $remoteTitle; } catch (Exception $e) { } - } else if (substr($remoteCloneUrl, 0, strlen($pri)) == $pri + } else if ($pri !== null + && substr($remoteCloneUrl, 0, strlen($pri)) == $pri && substr($remoteCloneUrl, -4) == '.git' ) { $id = substr($remoteCloneUrl, strlen($pri), -4);