2021-12-30 16:18:32 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function now()
|
|
|
|
{
|
|
|
|
return new DateTime("now");
|
|
|
|
}
|
|
|
|
|
|
|
|
function signalHandler($signal)
|
|
|
|
{
|
|
|
|
endMoha();
|
|
|
|
}
|
|
|
|
|
2022-01-02 13:47:41 +01:00
|
|
|
function notify($message)
|
|
|
|
{
|
|
|
|
foreach($notificationMethods as $value)
|
|
|
|
{
|
|
|
|
$result |= $value->send($message);
|
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
function logger($level, $log)
|
|
|
|
{
|
|
|
|
global $logFh, $logLevel;
|
|
|
|
if ( $level >= $logLevel)
|
|
|
|
{
|
|
|
|
fwrite($logFh, "$level : $log" . EOL);
|
|
|
|
print ("$level : $log" . EOL);
|
|
|
|
}
|
|
|
|
if ($level >= $notificationLevel)
|
|
|
|
{
|
|
|
|
if(notify($message) == true)
|
|
|
|
{
|
|
|
|
logger(INFO, __("Notification not sent"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-12-30 16:18:32 +01:00
|
|
|
|
|
|
|
?>
|