mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
captiveportal: simplify start/restart for #114
Even though the webgui is restarted selectively, the other function runs the complete captiveportal reconfigure and restarts all webguis again. I am suspecting this prevents the reload from working properly.
This commit is contained in:
parent
36b9cb78a2
commit
a98e94b345
@ -630,11 +630,13 @@ function captiveportal_init_webgui_zonename($zone) {
|
||||
}
|
||||
}
|
||||
|
||||
function captiveportal_init_webgui_zone($cpcfg) {
|
||||
function captiveportal_init_webgui_zone($cpcfg)
|
||||
{
|
||||
global $g, $config, $cpzone;
|
||||
|
||||
if (!isset($cpcfg['enable']))
|
||||
if (!isset($cpcfg['enable'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($cpcfg['httpslogin'])) {
|
||||
$cert = lookup_cert($cpcfg['certref']);
|
||||
@ -643,23 +645,45 @@ function captiveportal_init_webgui_zone($cpcfg) {
|
||||
$ca = ca_chain($cert);
|
||||
|
||||
/* generate lighttpd configuration */
|
||||
if (!empty($cpcfg['listenporthttps']))
|
||||
if (!empty($cpcfg['listenporthttps'])) {
|
||||
$listenporthttps = $cpcfg['listenporthttps'];
|
||||
else
|
||||
} else {
|
||||
$listenporthttps = 8001 + $cpcfg['zoneid'];
|
||||
system_generate_lighty_config("{$g['varetc_path']}/lighty-{$cpzone}-CaptivePortal-SSL.conf",
|
||||
$crt, $key, $ca, "lighty-{$cpzone}-CaptivePortal-SSL.pid", $listenporthttps, "/usr/local/captiveportal",
|
||||
"cert-{$cpzone}-portal.pem", "ca-{$cpzone}-portal.pem", $cpzone);
|
||||
}
|
||||
|
||||
system_generate_lighty_config(
|
||||
"{$g['varetc_path']}/lighty-{$cpzone}-CaptivePortal-SSL.conf",
|
||||
$crt,
|
||||
$key,
|
||||
$ca,
|
||||
"lighty-{$cpzone}-CaptivePortal-SSL.pid",
|
||||
$listenporthttps,
|
||||
"/usr/local/captiveportal",
|
||||
"cert-{$cpzone}-portal.pem",
|
||||
"ca-{$cpzone}-portal.pem",
|
||||
$cpzone
|
||||
);
|
||||
}
|
||||
|
||||
/* generate lighttpd configuration */
|
||||
if (!empty($cpcfg['listenporthttp']))
|
||||
if (!empty($cpcfg['listenporthttp'])) {
|
||||
$listenporthttp = $cpcfg['listenporthttp'];
|
||||
else
|
||||
} else {
|
||||
$listenporthttp = 8000 + $cpcfg['zoneid'];
|
||||
system_generate_lighty_config("{$g['varetc_path']}/lighty-{$cpzone}-CaptivePortal.conf",
|
||||
"", "", "", "lighty-{$cpzone}-CaptivePortal.pid", $listenporthttp, "/usr/local/captiveportal",
|
||||
"", "", $cpzone);
|
||||
}
|
||||
|
||||
system_generate_lighty_config(
|
||||
"{$g['varetc_path']}/lighty-{$cpzone}-CaptivePortal.conf",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"lighty-{$cpzone}-CaptivePortal.pid",
|
||||
$listenporthttp,
|
||||
"/usr/local/captiveportal",
|
||||
"",
|
||||
"",
|
||||
$cpzone
|
||||
);
|
||||
|
||||
@unlink("{$g['varrun']}/lighty-{$cpzone}-CaptivePortal.pid");
|
||||
/* attempt to start lighttpd */
|
||||
|
||||
@ -428,8 +428,7 @@ if (!function_exists('service_control_start')) {
|
||||
services_radvd_configure();
|
||||
break;
|
||||
case 'captiveportal':
|
||||
$zone = htmlspecialchars($extras['zone']);
|
||||
captiveportal_init_webgui_zonename($zone);
|
||||
captiveportal_configure();
|
||||
break;
|
||||
case 'ntpd':
|
||||
system_ntp_configure();
|
||||
@ -569,10 +568,6 @@ if (!function_exists('service_control_restart')) {
|
||||
services_radvd_configure();
|
||||
break;
|
||||
case 'captiveportal':
|
||||
$zone = htmlspecialchars($extras['zone']);
|
||||
killbypid("{$g['varrun_path']}/lighty-{$zone}-CaptivePortal.pid");
|
||||
killbypid("{$g['varrun_path']}/lighty-{$zone}-CaptivePortal-SSL.pid");
|
||||
captiveportal_init_webgui_zonename($zone);
|
||||
captiveportal_configure();
|
||||
break;
|
||||
case 'ntpd':
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user