mirror of
https://github.com/unraid/webgui.git
synced 2026-01-06 09:39:58 -06:00
Fix regression error in publish.php
- We still need the function "curl_socket"
This commit is contained in:
@@ -11,9 +11,9 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
function publish($endpoint, $message, $len=1) {
|
||||
$com = curl_init("http://localhost/pub/$endpoint?buffer_length=$len");
|
||||
curl_setopt_array($com, [CURLOPT_UNIX_SOCKET_PATH => "/var/run/nginx.socket", CURLOPT_HTTPHEADER => ['Accept:text/json'], CURLOPT_RETURNTRANSFER => 1]);
|
||||
function curl_socket($socket, $url, $message) {
|
||||
$com = curl_init($url);
|
||||
curl_setopt_array($com, [CURLOPT_UNIX_SOCKET_PATH => $socket, CURLOPT_HTTPHEADER => ['Accept:text/json'], CURLOPT_RETURNTRANSFER => 1]);
|
||||
$reply = json_decode(curl_exec($com),true);
|
||||
// only send message when active subscribers are present
|
||||
if (($reply['subscribers']??0)>0) {
|
||||
@@ -24,4 +24,8 @@ function publish($endpoint, $message, $len=1) {
|
||||
// return number of active subscribers
|
||||
return $reply['subscribers']??0;
|
||||
}
|
||||
|
||||
function publish($endpoint, $message, $len=1) {
|
||||
return curl_socket("/var/run/nginx.socket", "http://localhost/pub/$endpoint?buffer_length=$len", $message);
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user