-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathnewcommit.php
executable file
·33 lines (25 loc) · 1.05 KB
/
newcommit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
@ini_set('log_errors','On'); // enable or disable php error logging (use 'On' or 'Off')
@ini_set('display_errors','Off'); // enable or disable public display of errors (use 'On' or 'Off')
@ini_set('error_log','log.txt'); // path to server-writable log file
require 'Connection.php';
require 'Commit.php';
require 'Repository.php';
// retreive the data and decode json
$data = urldecode($_REQUEST['payload']);
$data = json_decode($data);
$file = "log.txt";
file_put_contents($file, "Payload: ".var_export($_REQUEST['payload'], true)."\r\r", FILE_APPEND);
file_put_contents($file, var_export($data->commits, true)."\r\r", FILE_APPEND);
if($data === null)
{
file_put_contents($file, "Y U NO DECODE??\r\r", FILE_APPEND);
echo "Y U NO DECODE?<br/>";
}
$repository = new Repository($data->repository);
foreach($data->commits as $commit)
{
file_put_contents($file, "Received:".$commit->url."\r\r", FILE_APPEND);
$repository->newCommit($commit);
}
file_put_contents($file, "==========================================================\r\r", FILE_APPEND);