Minor improvements to the GitLab example script

master
Lukas Bestle 12 years ago
parent 7a3fe21f3d
commit 67400ea81c

@ -47,13 +47,13 @@ define('TOOLKIT_PATH', '/home/<user>/bin');
* 9. Hit "Test Hook" in GitLab's settings interface. The project should be deployed a few seconds later. * 9. Hit "Test Hook" in GitLab's settings interface. The project should be deployed a few seconds later.
* *
* Troubleshooting: * Troubleshooting:
* - Use `cat <path to project>/logs/*.log`. This should tell you what went wrong. * - Use `tail -f <path to project>/logs/*.log`. This should tell you what went wrong.
* - Check if the TOOLKIT_PATH you set above is correct. * - Check if the TOOLKIT_PATH you set above is correct.
* - Check if you set the origin of your project to the correct URL. * - Check if you set the origin of your project to the correct URL.
* - Open the web hook URL you entered in GitLab in your browser and check if the output is "Authenticated, but no POST body sent.". * - Open the web hook URL you entered in GitLab in your browser and check if the output is "Authenticated, but no POST body sent.".
* - If there is no log file and you can't find the reason yourself, it is complicated. ;) * - If there is no log file and you can't find the reason yourself, it is complicated. ;)
* Debugging this is not easy (GitLab does not seem to store logs of its requests), but you can try to craft a JSON body like GitLab, * Debugging this is not easy (GitLab does not seem to store logs of its requests), but you can try to craft a JSON body like GitLab,
* send it to this script by using cURLor GUI tools like Rested and it will tell you exactly what went wrong. * send it to this script by using cURL or GUI tools like Rested and it will tell you exactly what went wrong.
*/ */
// 3. Done // 3. Done
@ -70,8 +70,7 @@ if(!isset($_GET['token']) || $_GET['token'] !== AUTH_TOKEN) {
} }
// Get the request body // Get the request body
$inputPointer = fopen('php://input', 'r'); $input = file_get_contents('php://input');
$input = stream_get_contents($inputPointer);
if(!$input) { if(!$input) {
http_response_code(405); http_response_code(405);
die('Authenticated, but no POST body sent.'); die('Authenticated, but no POST body sent.');

Loading…
Cancel
Save