check for posix module in nottifications extension

This commit is contained in:
maxpozdeev 2023-12-17 17:45:04 +03:00
parent 7058769c96
commit f31b97c4c7
3 changed files with 8 additions and 4 deletions

View file

@ -20,7 +20,7 @@ class Sender
function __construct(array $prefs, bool $useCli = false)
{
$this->prefs = $prefs;
if ($useCli && function_exists('pcntl_fork')) {
if ($useCli && function_exists('pcntl_fork') && function_exists('posix_setsid')) {
$this->cli = true;
}
}
@ -193,7 +193,7 @@ class Sender
$host = parse_url(get_unsafe_mttinfo('url'), PHP_URL_HOST);
$host = preg_replace('/^(www\.)/', '', $host);
//$host = gethostname();
if (function_exists('posix_getuid') && false !== ($userinfo = posix_getpwuid(posix_getuid())) ) {
if (function_exists('posix_getpwuid') && false !== ($userinfo = posix_getpwuid(posix_getuid())) ) {
return $userinfo['name']. '@'. $host;
}
return "mytinytodo@$host";

View file

@ -2,7 +2,7 @@
/*
This file is a part of myTinyTodo.
(C) Copyright 2022 Max Pozdeev <maxpozdeev@gmail.com>
(C) Copyright 2022-2023 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
@ -16,6 +16,10 @@ if (!function_exists('pcntl_fork')) {
error_log("Required PHP module is not found: pcntl");
exit(-2);
}
if (!function_exists('posix_setsid')) {
error_log("Required PHP module is not found: posix");
exit(-2);
}
$dontStartSession = 1;
require(__DIR__.'/../../init.php');

View file

@ -1,6 +1,6 @@
{
"bundleId": "notifications",
"name": "Notifications",
"version": "1.1",
"version": "1.2",
"description": "Notify about new tasks and lists on e-mail or telegram"
}