server/onyx/include/functions.php

29 lines
700 B
PHP
Raw Normal View History

2013-10-09 13:40:23 +00:00
<?php
2013-10-10 03:13:45 +00:00
function erreur($message, $color="danger")
2013-10-09 13:40:23 +00:00
{
global $template;
$template->assign('ERRmessage', $message);
$template->assign('ERRcolor', $color);
}
2015-01-14 09:56:27 +00:00
function pipe_backend_scheduler($instruct)
2013-10-09 13:40:23 +00:00
{
2015-01-14 09:56:27 +00:00
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."\r\n") or die(socket_strerror(socket_last_error()));
sleep(1);
socket_shutdown($socket);
socket_close($socket);
}
else if(defined("DEBUG") && DEBUG)
{
print("Socket '".$VAR["scheduler_socket"]."' is not writable by ".$_SERVER["USER"]." user!");
exit(1);
}
2013-10-09 13:40:23 +00:00
}