Reload .ini after save, fix LogEnable condition

This commit is contained in:
billz
2025-11-17 09:55:54 +01:00
parent 95229fd1b7
commit 49ee0751d0

View File

@@ -45,8 +45,10 @@ function DisplayHostAPDConfig()
} else { } else {
$interface = $_SESSION['ap_interface']; $interface = $_SESSION['ap_interface'];
} }
$txpower = $hotspot->getTxPower($interface); $txpower = $hotspot->getTxPower($interface);
$arrHostapdConf = $hotspot->getHostapdIni(); $arrHostapdConf = $hotspot->getHostapdIni();
$logOutput = [];
if (!RASPI_MONITOR_ENABLED) { if (!RASPI_MONITOR_ENABLED) {
if (isset($_POST['StartHotspot']) || isset($_POST['RestartHotspot'])) { if (isset($_POST['StartHotspot']) || isset($_POST['RestartHotspot'])) {
@@ -77,6 +79,10 @@ function DisplayHostAPDConfig()
$reg_domain, $reg_domain,
$status $status
); );
// reload hostapi.ini
$arrHostapdConf = $hotspot->getHostapdIni();
} elseif (isset($_POST['StopHotspot'])) { } elseif (isset($_POST['StopHotspot'])) {
$status->addMessage('Attempting to stop hotspot', 'info'); $status->addMessage('Attempting to stop hotspot', 'info');
exec('sudo /bin/systemctl stop hostapd.service', $return); exec('sudo /bin/systemctl stop hostapd.service', $return);
@@ -136,8 +142,7 @@ function DisplayHostAPDConfig()
} }
// fetch hostapd logs if enabled // fetch hostapd logs if enabled
$logOutput = []; if ((string)$arrHostapdConf['LogEnable'] === "1") {
if (!empty($arrHostapdConf['LogEnable']) && (int)$arrHostapdConf['LogEnable'] === 1) {
$logResult = $hotspot->getHostapdLogs(5000); $logResult = $hotspot->getHostapdLogs(5000);
if ($logResult['success']) { if ($logResult['success']) {
$joined = implode("\n", $logResult['logs']); $joined = implode("\n", $logResult['logs']);