From b451971c46726acd2505e04a7614b6974e1ec2a5 Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 16 Nov 2025 21:34:25 +0100 Subject: [PATCH] Replace enable/disable log scripts (deprecated) w/ logger_syslog=-1 --- .../Networking/Hotspot/HostapdManager.php | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/src/RaspAP/Networking/Hotspot/HostapdManager.php b/src/RaspAP/Networking/Hotspot/HostapdManager.php index c9d0a5ef..0caa1523 100644 --- a/src/RaspAP/Networking/Hotspot/HostapdManager.php +++ b/src/RaspAP/Networking/Hotspot/HostapdManager.php @@ -225,6 +225,12 @@ class HostapdManager $config[] = 'max_num_sta=' . (int)$params['max_num_sta']; } + // add logging configuration if enabled + if (!empty($params['log_enable'])) { + $config[] = 'logger_syslog=-1'; + $config[] = 'logger_syslog_level=0'; + } + // optional additional user config $config[] = $this->parseUserHostapdCfg(); @@ -325,17 +331,6 @@ class HostapdManager return [$apIface, $cliIface, $sessionIface]; } - /** - * Enables or disables hostapd logging - * - * @param int $logEnable - */ - private function handleLogState(int $logEnable): void - { - $script = $logEnable === 1 ? 'enablelog.sh' : 'disablelog.sh'; - exec('sudo ' . RASPI_CONFIG . '/hostapd/' . $script); - } - /** * Parses optional /etc/hostapd/hostapd.conf.users file * @@ -415,8 +410,6 @@ class HostapdManager */ public function persistHostapdIni(array $states, string $apIface, string $cliIface, array $previousIni = []): bool { - $this->applyLogState($states['LogEnable']); - // compose new ini payload $cfg = [ 'WifiInterface' => $apIface, @@ -435,17 +428,6 @@ class HostapdManager return write_php_ini($cfg, RASPI_CONFIG . '/hostapd.ini'); } - /** - * Enables or disables hostapd logging - * - * @param int $logEnable 1 = enable, 0 = disable - */ - private function applyLogState(int $logEnable): void - { - $script = $logEnable === 1 ? 'enablelog.sh' : 'disablelog.sh'; - exec('sudo ' . RASPI_CONFIG . '/hostapd/' . $script); - } - /** * Returns a count of hostapd-.conf files *