mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
dpinger: reshuffle some related code
This commit is contained in:
parent
494ba0b7b5
commit
9f54891523
@ -82,25 +82,6 @@ function core_services()
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
|
||||
if (is_dpinger_enabled()) {
|
||||
foreach ($config['gateways']['gateway_item'] as $gateway) {
|
||||
if (isset($gateway['monitor_disable'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$pconfig = array();
|
||||
$pconfig['description'] = sprintf(gettext('Gateway Monitor (%s)'), $gateway['name']);
|
||||
$pconfig['php']['restart'] = array('setup_gateways_monitor');
|
||||
$pconfig['php']['start'] = array('setup_gateways_monitor');
|
||||
$pconfig['pidfile'] = "/var/run/dpinger_{$gateway['name']}.pid";
|
||||
$pconfig['php']['args'] = array('verbose', 'id');
|
||||
$pconfig['name'] = 'dpinger';
|
||||
$pconfig['verbose'] = false;
|
||||
$pconfig['id'] = $gateway['name'];
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($config['OPNsense']['captiveportal']['zones']['zone'])) {
|
||||
$enabled = false;
|
||||
if (!empty($config['OPNsense']['captiveportal']['zones']['zone']['enabled'])) {
|
||||
|
||||
@ -30,6 +30,57 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
function dpinger_enabled()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$gwcount = 0;
|
||||
|
||||
if (isset($config['gateways']['gateway_item'])) {
|
||||
foreach ($config['gateways']['gateway_item'] as $gwkey => $gateway) {
|
||||
if (!isset($gateway['monitor_disable']) || $gateway['monitor_disable'] == '0') {
|
||||
$gwcount += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($gwcount == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function dpinger_services()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$services = array();
|
||||
|
||||
if (!dpinger_enabled()) {
|
||||
return $services;
|
||||
}
|
||||
|
||||
foreach ($config['gateways']['gateway_item'] as $gateway) {
|
||||
if (isset($gateway['monitor_disable'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$pconfig = array();
|
||||
$pconfig['description'] = sprintf(gettext('Gateway Monitor (%s)'), $gateway['name']);
|
||||
$pconfig['php']['restart'] = array('setup_gateways_monitor');
|
||||
$pconfig['php']['start'] = array('setup_gateways_monitor');
|
||||
$pconfig['pidfile'] = "/var/run/dpinger_{$gateway['name']}.pid";
|
||||
$pconfig['php']['args'] = array('verbose', 'id');
|
||||
$pconfig['name'] = 'dpinger';
|
||||
$pconfig['verbose'] = false;
|
||||
$pconfig['id'] = $gateway['name'];
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
function dpinger_defaults()
|
||||
{
|
||||
return array(
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
* targets in the future:
|
||||
*/
|
||||
require_once('plugins.inc.d/dnsmasq.inc');
|
||||
require_once('plugins.inc.d/dpinger.inc');
|
||||
require_once('plugins.inc.d/ipsec.inc');
|
||||
require_once('plugins.inc.d/openssh.inc');
|
||||
require_once('plugins.inc.d/openvpn.inc');
|
||||
@ -1762,27 +1763,6 @@ function get_dyndns_ip($int, $ipver = 4)
|
||||
return $ip_address;
|
||||
}
|
||||
|
||||
function is_dpinger_enabled()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$gwcount = 0;
|
||||
|
||||
if (isset($config['gateways']['gateway_item'])) {
|
||||
foreach ($config['gateways']['gateway_item'] as $gwkey => $gateway) {
|
||||
if (!isset($gateway['monitor_disable']) || $gateway['monitor_disable'] == '0') {
|
||||
$gwcount += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($gwcount == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function services_get()
|
||||
{
|
||||
$services = array();
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
require_once('config.inc');
|
||||
require_once('interfaces.inc');
|
||||
require_once('util.inc');
|
||||
require_once('plugins.inc.d/dpinger.inc'); /* XXX remove me */
|
||||
require_once('services.inc');
|
||||
|
||||
/**
|
||||
* @param string $status
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
require_once("guiconfig.inc");
|
||||
require_once("filter.inc");
|
||||
require_once("system.inc");
|
||||
require_once("plugins.inc.d/dpinger.inc"); /* XXX remove me */
|
||||
require_once("services.inc");
|
||||
require_once("rrd.inc");
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user