Commit 1b6984c7 authored by Franco Fichtner's avatar Franco Fichtner

inc: remove a wee bit of over-engineering

Hides complexity to make it easier to migrate away from
the legacy 'check_reload_status' soon.
parent e40924c6
...@@ -34,7 +34,6 @@ register_shutdown_function('closelog'); ...@@ -34,7 +34,6 @@ register_shutdown_function('closelog');
$g = array( $g = array(
"base_packages" => "siproxd", "base_packages" => "siproxd",
"event_address" => "unix:///var/run/check_reload_status",
"factory_shipped_username" => "root", "factory_shipped_username" => "root",
"factory_shipped_password" => "opnsense", "factory_shipped_password" => "opnsense",
"upload_path" => "/root", "upload_path" => "/root",
......
...@@ -173,50 +173,9 @@ function unlock_force($lock) { ...@@ -173,50 +173,9 @@ function unlock_force($lock) {
@unlink("{$g['tmp_path']}/{$lock}.lock"); @unlink("{$g['tmp_path']}/{$lock}.lock");
} }
function send_event($cmd) { function send_event($cmd)
global $g; {
return mwexec("/usr/local/sbin/pfSctl -c '{$cmd}'");
if(!isset($g['event_address']))
$g['event_address'] = "unix:///var/run/check_reload_status";
$try = 0;
while ($try < 3) {
$fd = @fsockopen($g['event_address']);
if ($fd) {
fwrite($fd, $cmd);
$resp = fread($fd, 4096);
if ($resp != "OK\n")
log_error("send_event: sent {$cmd} got {$resp}");
fclose($fd);
$try = 3;
}
$try++;
}
}
function send_multiple_events($cmds) {
global $g;
if(!isset($g['event_address']))
$g['event_address'] = "unix:///var/run/check_reload_status";
if (!is_array($cmds))
return;
while ($try < 3) {
$fd = @fsockopen($g['event_address']);
if ($fd) {
foreach ($cmds as $cmd) {
fwrite($fd, $cmd);
$resp = fread($fd, 4096);
if ($resp != "OK\n")
log_error("send_event: sent {$cmd} got {$resp}");
}
fclose($fd);
$try = 3;
}
$try++;
}
} }
function refcount_init($reference) { function refcount_init($reference) {
......
...@@ -262,7 +262,7 @@ echo "done.\n"; ...@@ -262,7 +262,7 @@ echo "done.\n";
if($realmem > 0 and $realmem < 65) { if($realmem > 0 and $realmem < 65) {
echo "System has less than 65 megabytes of ram {$realmem}. Delaying webConfigurator startup.\n"; echo "System has less than 65 megabytes of ram {$realmem}. Delaying webConfigurator startup.\n";
/* start webConfigurator up on final pass */ /* start webConfigurator up on final pass */
mwexec("/usr/local/sbin/pfSctl -c 'service restart webgui'"); send_event('service restart webgui');
} else { } else {
/* start web server */ /* start web server */
system_webgui_start(); system_webgui_start();
......
...@@ -250,8 +250,9 @@ if ($_POST) { ...@@ -250,8 +250,9 @@ if ($_POST) {
$retval |= system_timezone_configure(); $retval |= system_timezone_configure();
$retval |= system_ntp_configure(); $retval |= system_ntp_configure();
if ($olddnsallowoverride != $config['system']['dnsallowoverride']) if ($olddnsallowoverride != $config['system']['dnsallowoverride']) {
$retval |= send_event("service reload dns"); send_event("service reload dns");
}
// Reload the filter - plugins might need to be run. // Reload the filter - plugins might need to be run.
$retval |= filter_configure(); $retval |= filter_configure();
......
<?php <?php
/* /*
Copyright (C) 2014-2015 Deciso B.V. Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>. Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
...@@ -48,7 +49,10 @@ if ($_POST) { ...@@ -48,7 +49,10 @@ if ($_POST) {
$retval = 0; $retval = 0;
$retval = system_routing_configure(); $retval = system_routing_configure();
send_multiple_events(array("service reload dyndnsall", "service reload ipsecdns", "filter reload"));
send_event('service reload dyndnsall');
send_event('service reload ipsecdns');
send_event('filter reload');
/* reconfigure our gateway monitor */ /* reconfigure our gateway monitor */
setup_gateways_monitor(); setup_gateways_monitor();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment