Ejemplo n.º 1
0
    Log::event('Malformed configuration');
    exit(1);
}
if (array_key_exists('HTTP_X_GITHUB_EVENT', $_SERVER) && isset($input->repository->ssh_url)) {
    // GitHub
    if ($_SERVER['HTTP_X_GITHUB_EVENT'] == 'push') {
        if (!Git::search($input->repository->ssh_url)) {
            Log::struct($input);
        }
    } else {
        Log::event('Received a GitHub webhook of unhandled kind (' . $_SERVER['HTTP_X_GITHUB_EVENT'] . ')');
        Log::struct($input);
    }
} elseif (array_key_exists('HTTP_X_GITLAB_EVENT', $_SERVER) && isset($input->repository->git_ssh_url)) {
    // GitLab
    if ($_SERVER['HTTP_X_GITLAB_EVENT'] == 'Push Hook') {
        if (!Git::search($input->repository->git_ssh_url)) {
            Log::struct($input);
        }
    } else {
        Log::event('Received a GitLab webhook of unhandled kind (' . $_SERVER['HTTP_X_GITLAB_EVENT'] . ')');
        Log::struct($input);
    }
} else {
    // Something else
    header('HTTP/1.1 501 Not Implemented');
    Log::client('Unhandled request');
    Log::event('Received unhandled request');
    Log::struct($input);
}
Log::close();