Fix PHP communication with socket
This commit is contained in:
parent
e8e0b4478b
commit
7865fbdf1f
@ -15,6 +15,7 @@ if (count($p) > 2)
|
|||||||
|
|
||||||
case "init":
|
case "init":
|
||||||
unlink($VAR["misc_dir"]."/challenge_started");
|
unlink($VAR["misc_dir"]."/challenge_started");
|
||||||
|
pipe_backend_scheduler("resetreset:HOME:all:SY");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,15 +24,22 @@ if (is_file($VAR["misc_dir"]."/challenge_started"))
|
|||||||
|
|
||||||
function pipe_backend_scheduler($instruct)
|
function pipe_backend_scheduler($instruct)
|
||||||
{
|
{
|
||||||
|
global $VAR;
|
||||||
|
|
||||||
$socket = socket_create(AF_UNIX, SOCK_STREAM, 0);
|
$socket = socket_create(AF_UNIX, SOCK_STREAM, 0);
|
||||||
if (is_writable($VAR["scheduler_socket"]) && socket_connect($socket, $VAR["scheduler_socket"]))
|
if (is_writable($VAR["scheduler_socket"]) && socket_connect($socket, $VAR["scheduler_socket"]))
|
||||||
{
|
{
|
||||||
socket_write($socket, $instruct);
|
socket_write($socket, $instruct);
|
||||||
socket_close($socket);
|
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']))
|
if (!empty($VAR['misc_dir']))
|
||||||
$template->assign("MISC_DIR", $VAR['misc_dir']);
|
$template->assign("MISC_DIR", $VAR['misc_dir']);
|
||||||
if (!empty($LANG))
|
if (!empty($LANG))
|
||||||
$template->assign("LANG", $LANG);
|
$template->assign("LANG", $LANG);
|
||||||
|
Loading…
Reference in New Issue
Block a user