mirror of
https://github.com/mbirth/tcl_update_db.git
synced 2024-12-26 12:34:07 +00:00
Add notification to webhook on new updates.
This commit is contained in:
parent
f37b98cbee
commit
42c026a618
19
index.php
19
index.php
@ -42,6 +42,25 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||||||
if ($g->tv) {
|
if ($g->tv) {
|
||||||
$sqlw = new SQLiteWriter();
|
$sqlw = new SQLiteWriter();
|
||||||
$result = $sqlw->addGotu($g, $file_date);
|
$result = $sqlw->addGotu($g, $file_date);
|
||||||
|
if ($result !== false) {
|
||||||
|
$config = parse_ini_file(__DIR__ . '/config.ini');
|
||||||
|
$type = 'FULL';
|
||||||
|
if ($g->fv) {
|
||||||
|
$type = 'OTA (from ' . $g->fv . ')';
|
||||||
|
}
|
||||||
|
$data = array(
|
||||||
|
'content' => 'New ' . $type . ' update for ' . $g->ref . ' found: ' . $g->tv,
|
||||||
|
);
|
||||||
|
$options = array(
|
||||||
|
'http' => array(
|
||||||
|
'header' => "Content-Type: application/x-www-form-urlencoded\r\n",
|
||||||
|
'method' => 'POST',
|
||||||
|
'content' => http_build_query($data),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$ctx = stream_context_create($options);
|
||||||
|
$notify_ok = file_get_contents($config['NOTIFY_WEBHOOK'], false, $ctx);
|
||||||
|
}
|
||||||
// I don't care if we can use the data or not. Maybe we can use it later (backup copy).
|
// I don't care if we can use the data or not. Maybe we can use it later (backup copy).
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user