Fix PHP communication with socket
This commit is contained in:
parent
e8e0b4478b
commit
7865fbdf1f
@ -15,6 +15,7 @@ if (count($p) > 2)
|
||||
|
||||
case "init":
|
||||
unlink($VAR["misc_dir"]."/challenge_started");
|
||||
pipe_backend_scheduler("resetreset:HOME:all:SY");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -24,12 +24,19 @@ if (is_file($VAR["misc_dir"]."/challenge_started"))
|
||||
|
||||
function pipe_backend_scheduler($instruct)
|
||||
{
|
||||
global $VAR;
|
||||
|
||||
$socket = socket_create(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (is_writable($VAR["scheduler_socket"]) && socket_connect($socket, $VAR["scheduler_socket"]))
|
||||
{
|
||||
socket_write($socket, $instruct);
|
||||
socket_close($socket);
|
||||
}
|
||||
else if(defined("DEBUG") && DEBUG)
|
||||
{
|
||||
print("Socket '".$VAR["scheduler_socket"]."' is not writable by ".$_SERVER["USER"]." user!");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($VAR['misc_dir']))
|
||||
|
Loading…
Reference in New Issue
Block a user