diff --git a/lib/scm/gitlab.class.php b/lib/scm/gitlab.class.php index 0843f0001f..200bf61b15 100644 --- a/lib/scm/gitlab.class.php +++ b/lib/scm/gitlab.class.php @@ -780,13 +780,14 @@ class gitlab } else { - $response = commonModel::http($api); + list($response, $httpCode) = commonModel::http($api, null, array(), array(), 'data', 'Post', 30, true); if(!empty(commonModel::$requestErrors)) { commonModel::$requestErrors = array(); return array(); } + if($httpCode == 500) return array(); return json_decode($response); } } diff --git a/module/common/model.php b/module/common/model.php index 90d100a3ed..c6c4974b34 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -3203,11 +3203,13 @@ EOD; * @param array $headers Set request headers. * @param string $dataType * @param string $method POST|PATCH|PUT + * @param int $timeout + * @param bool $httpCode * @static * @access public * @return string */ - public static function http($url, $data = null, $options = array(), $headers = array(), $dataType = 'data', $method = 'POST', $timeout = 30) + public static function http($url, $data = null, $options = array(), $headers = array(), $dataType = 'data', $method = 'POST', $timeout = 30, $httpCode = false) { global $lang, $app; if(!extension_loaded('curl')) @@ -3254,6 +3256,7 @@ EOD; $response = curl_exec($curl); $errors = curl_error($curl); + if($httpCode) $httpCode = curl_getinfo($curl,CURLINFO_HTTP_CODE); curl_close($curl); $logFile = $app->getLogRoot() . 'saas.'. date('Ymd') . '.log.php'; @@ -3272,7 +3275,7 @@ EOD; if($errors) commonModel::$requestErrors[] = $errors; - return $response; + return $httpCode ? array($response, $httpCode) : $response; } /**