1
0
moha/utils.php

34 lines
616 B
PHP

<?php
function now()
{
return new DateTime("now");
}
function notify($message)
{
global $notificationMethods;
$result = false;
foreach($notificationMethods as $value)
{
$result = $result | $value->send($message);
}
return $result;
}
function mktopic($device)
{
return $device->topic . "/" . $device->friendlyName;
}
logger(DEBUG, _("signal handling"), false);
//signal handling
function signalHandler($signal)
{
endMoha();
}
pcntl_signal(SIGTERM, 'signalHandler');// Termination ('kill' was called)
pcntl_signal(SIGHUP, 'signalHandler'); // Terminal log-out
pcntl_signal(SIGINT, 'signalHandler');
?>