나는 모든 당신이 필요합니까 무엇이 스크립트를 발견
이
후크를 받아 봐 웹 후크의 쿼리 삽입을 실행
PHP로 실행 0.0.0.0:8080
<?php
$allowed_host = "ip_of_your_gitlab_server";
$sql_host = "localhost_or_ip_of_your_mysql_server";
$sql_user = "..";
$sql_password = "..";
$database = "gitlabhq_production";
if ($_SERVER['REMOTE_ADDR'] == $allowed_host) { // ofc you could increase security with some kind of API key or w/e
$sql = mysqli_connect($sql_host, $sql_user, $sql_password, $database);
if (mysqli_connect_errno()) {
exit;
}
$file = fopen("/tmp/sql_error", "a"); // you can use this as debug log too ;)
$input = json_decode(file_get_contents('php://input'), true);
$pid = $input['project_id'];
if ($input['event_name'] == "project_create") {
$url = 'url_of_your_project_hook';
// this creates a project hook, specify it for your needs..
$q = mysqli_query($sql, "INSERT INTO gitlabhq_production.web_hooks (url, project_id) VALUES('$url', '$pid')");
if (!$q) fwrite($file, $sql->error);
} elseif ($input['event_name'] == "project_destroy")
$q = mysqli_query($sql, "DELETE FROM gitlabhq_production.web_hooks WHERE project_id='$pid'");
mysqli_close($sql);
} else {
// redirect?
exit;
}
감사 -S ! 그 트릭을 했어! –
@KunalAggarwal 어떻게했는지 예제를 제공해 줄 수 있습니까? – Adrian