mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 08:34:39 +00:00
system: provided by legacy bindings are facilities...
... which are bound to MVC code. Move remaining "pure" gateway functions to the legacy_bindings and use plugins_run() stub to get to the dpinger data... The data could later be coalesced or split up, but for now that seems reasonable enough (provided it works ok and @adschellevis more or less likes this direction).
This commit is contained in:
parent
0e8943c94a
commit
168be32071
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
require_once("interfaces.lib.inc");
|
||||
require_once("plugins.inc.d/dpinger.inc"); /* XXX remove me */
|
||||
|
||||
/*
|
||||
* converts a string like "a,b,c,d"
|
||||
|
||||
@ -159,3 +159,36 @@ function get_alias_description($name)
|
||||
{
|
||||
return OPNsense\Firewall\Util::aliasDescription($name);
|
||||
}
|
||||
|
||||
function return_gateways_status()
|
||||
{
|
||||
/* XXX quick and dirty compat layer */
|
||||
$result = plugins_run('return_gateways_status');
|
||||
|
||||
if (!empty($result['dpinger'])) {
|
||||
return $result['dpinger'];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
function return_down_gateways()
|
||||
{
|
||||
$result = array();
|
||||
foreach (return_gateways_status() as $gwname => $stat) {
|
||||
if (strpos($stat['status'], 'down') !== false) {
|
||||
$result[] = $gwname;
|
||||
}
|
||||
}
|
||||
return $result ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return an array with all gateway groups with name as key
|
||||
* All gateway groups will be processed before returning the array.
|
||||
*/
|
||||
function return_gateway_groups_array()
|
||||
{
|
||||
$gateways = new \OPNsense\Routing\Gateways(legacy_interfaces_details());
|
||||
return $gateways->getGroups(return_gateways_status());
|
||||
}
|
||||
|
||||
@ -298,7 +298,14 @@ function dpinger_configure_do($verbose = false, $gwname = null)
|
||||
}
|
||||
}
|
||||
|
||||
function return_gateways_status()
|
||||
function dpinger_run()
|
||||
{
|
||||
return array(
|
||||
'return_gateways_status' => array('dpinger_status'),
|
||||
);
|
||||
}
|
||||
|
||||
function dpinger_status($verbose = false, $status)
|
||||
{
|
||||
$status = array();
|
||||
|
||||
@ -396,27 +403,6 @@ function return_gateways_status()
|
||||
return $status;
|
||||
}
|
||||
|
||||
function return_down_gateways()
|
||||
{
|
||||
$result = array();
|
||||
foreach (return_gateways_status() as $gwname => $stat) {
|
||||
if (strpos($stat['status'], 'down') !== false) {
|
||||
$result[] = $gwname;
|
||||
}
|
||||
}
|
||||
return $result ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return an array with all gateway groups with name as key
|
||||
* All gateway groups will be processed before returning the array.
|
||||
*/
|
||||
function return_gateway_groups_array()
|
||||
{
|
||||
$gateways = new \OPNsense\Routing\Gateways(legacy_interfaces_details());
|
||||
return $gateways->getGroups(return_gateways_status());
|
||||
}
|
||||
|
||||
function dpinger_processes()
|
||||
{
|
||||
$result = array();
|
||||
|
||||
@ -28,9 +28,7 @@
|
||||
*/
|
||||
|
||||
require_once('config.inc');
|
||||
require_once('interfaces.inc');
|
||||
require_once('util.inc');
|
||||
require_once('plugins.inc.d/dpinger.inc'); /* XXX remove me */
|
||||
|
||||
/**
|
||||
* @param string $status
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user