* Finish task #46544,46556.

This commit is contained in:
liyuchun
2021-12-30 14:05:57 +08:00
parent 07756750db
commit 1f4ee55810
11 changed files with 285 additions and 48 deletions
+39
View File
@@ -0,0 +1,39 @@
<?php
/**
* The repo entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author xiawenlong <xiawenlong@cnezsoft.com>
* @package repo
* @version 1
* @link http://www.zentao.net
*/
class gitlabWebhookEntry extends baseEntry
{
/**
* Repo webhook.
*
* @access public
* @return void
*/
public function post()
{
$repoID = $this->param('repoID');
if(empty($repoID)) return;
$this->loadModel('repo');
$repo = $this->repo->getRepoByID($repoID);
if(empty($repo)) return;
$headers = getallheaders(); /* Fetch all HTTP request headers. */
$event = isset($headers['X-Gitlab-Event']) ? $headers['X-Gitlab-Event'] : '';
$token = isset($headers['X-Gitlab-Token']) ? $headers['X-Gitlab-Token'] : '';
if(empty($event) || empty($token)) return;
$this->repo->handleWebhook($event, $token, $this->requestBody, $repo);
}
}