system: remove $restart and $async flags

See: https://github.com/opnsense/core/commit/d8c6c21f11e
See: https://github.com/opnsense/core/commit/4e9a8abf987
This commit is contained in:
Franco Fichtner 2021-11-08 09:47:12 +01:00
parent 4b1bb2af98
commit 8f481dfcc0
5 changed files with 19 additions and 20 deletions

View File

@ -600,7 +600,7 @@ function system_staticroutes_configure($interface = '')
}
}
function system_syslogd_start($verbose = false, $restart = false, $async = false)
function system_syslogd_start($verbose = false)
{
global $config;
@ -609,17 +609,13 @@ function system_syslogd_start($verbose = false, $restart = false, $async = false
flush();
}
if ($async) {
// Loopback in background
configd_run('syslog restart', true);
configd_run('template reload OPNsense/Syslog');
mwexecf('/usr/local/opnsense/scripts/syslog/generate_certs');
if (isvalidpid('/var/run/syslog-ng.pid')) {
mwexecf('/usr/local/sbin/syslog-ng-ctl reload');
} else {
configd_run('template reload OPNsense/Syslog');
mwexecf("/usr/local/opnsense/scripts/syslog/generate_certs");
if (!$restart && isvalidpid('/var/run/syslog-ng.pid')) {
mwexecf("/usr/local/sbin/syslog-ng-ctl reload");
} else {
mwexecf("/usr/sbin/service syslog-ng restart");
}
mwexecf('/usr/sbin/service syslog-ng restart');
}
if ($verbose) {
@ -627,12 +623,9 @@ function system_syslogd_start($verbose = false, $restart = false, $async = false
}
}
/**
* stop syslog-ng
*/
function system_syslogd_stop()
{
mwexecf("/usr/sbin/service syslog-ng stop");
mwexecf('/usr/sbin/service syslog-ng stop');
}
/*

View File

@ -122,8 +122,11 @@ system_powerd_configure(true);
* Give syslogd a kick after everything else has been
* initialized, otherwise it can occasionally fail to
* route syslog messages properly on both IPv4 and IPv6.
*
* XXX dynamic addressing might not be set up here yet,
* because these events are blocked by /var/run/booting
*/
system_syslogd_start(true, true);
system_syslogd_start(true);
system_console_unmute();

View File

@ -48,7 +48,7 @@ convert_config(true);
system_firmware_configure(true);
system_trust_configure(true);
system_login_configure(true);
system_syslogd_start(true, false, true);
system_syslogd_start(true);
/* flush user-facing caches */
(new OPNsense\Core\ACL())->invalidateCache();

View File

@ -42,7 +42,7 @@ $script = !empty($argv[1]) ? $argv[1] : 'POST_INSTALL';
/* reload subsystem that may have changed */
if ($script == 'POST_INSTALL') {
system_syslogd_start(true, false, true);
system_syslogd_start(true);
}
/* flush user-facing caches */

View File

@ -36,7 +36,9 @@ require_once("system.inc");
function clear_all_log_files()
{
$it = new RecursiveDirectoryIterator("/var/log");
system_syslogd_stop();
$it = new RecursiveDirectoryIterator('/var/log');
foreach(new RecursiveIteratorIterator($it) as $file) {
if ($file->isFile() && strpos($file->getFilename(), '.log') > -1) {
if (strpos($file->getFilename(), 'flowd') === false) {
@ -44,6 +46,7 @@ function clear_all_log_files()
}
}
}
system_syslogd_start();
plugins_configure('dhcp');
}
@ -107,7 +110,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
write_config();
system_syslogd_start(false, true);
system_syslogd_start();
if (($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock']))
|| ($oldnologdefaultpass !== isset($config['syslog']['nologdefaultpass']))