mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-10-26 13:08:38 -04:00
Workaround disabled openlog syslog (#5054)
* Workaround disabled openlog syslog #fix https://github.com/FreshRSS/FreshRSS/issues/5053 #fix https://github.com/FreshRSS/FreshRSS/issues/5027 * COPY_SYSLOG_TO_STDERR * Better return * Simplify openlog
This commit is contained in:
1 parent
9e4b4c9072
commit
4ad66c24bf
1 file changed
+21
-5
+21
-5
@@ -16,11 +16,27 @@ if (!function_exists('str_starts_with')) {
|
||||
}
|
||||
}
|
||||
|
||||
// @phpstan-ignore-next-line
|
||||
if (COPY_SYSLOG_TO_STDERR) {
|
||||
openlog('FreshRSS', LOG_CONS | LOG_ODELAY | LOG_PID | LOG_PERROR, LOG_USER);
|
||||
} else {
|
||||
openlog('FreshRSS', LOG_CONS | LOG_ODELAY | LOG_PID, LOG_USER);
|
||||
if (!function_exists('syslog')) {
|
||||
// @phpstan-ignore-next-line
|
||||
if (COPY_SYSLOG_TO_STDERR && !defined('STDERR')) {
|
||||
define('STDERR', fopen('php://stderr', 'w'));
|
||||
}
|
||||
function syslog(int $priority, string $message): bool {
|
||||
// @phpstan-ignore-next-line
|
||||
if (COPY_SYSLOG_TO_STDERR && defined('STDERR') && STDERR) {
|
||||
return fwrite(STDERR, $message . "\n") != false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (function_exists('openlog')) {
|
||||
// @phpstan-ignore-next-line
|
||||
if (COPY_SYSLOG_TO_STDERR) {
|
||||
openlog('FreshRSS', LOG_CONS | LOG_ODELAY | LOG_PID | LOG_PERROR, LOG_USER);
|
||||
} else {
|
||||
openlog('FreshRSS', LOG_CONS | LOG_ODELAY | LOG_PID, LOG_USER);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user