mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 00:54:41 +00:00
Gateways, move setIfconfig to constructor, since its required for proper use anyway. for https://github.com/opnsense/core/issues/2279
This commit is contained in:
parent
dde1180b51
commit
b7ce18e24d
@ -44,19 +44,14 @@ class Gateways
|
||||
|
||||
/**
|
||||
* Construct new gateways object
|
||||
* @param array $ifconfig containing serialized ifconfig data
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(array $ifconfig)
|
||||
{
|
||||
$this->configHandle = Config::getInstance()->object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $payload containing serialized ifconfig data
|
||||
*/
|
||||
public function setIfconfig($payload)
|
||||
{
|
||||
$this->ifconfig = $payload;
|
||||
return $this;
|
||||
if ($ifconfig !== null) {
|
||||
$this->ifconfig = $ifconfig;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -109,7 +109,7 @@ function delete_gateway_item($id, $a_gateways)
|
||||
}
|
||||
|
||||
// fetch gateway list including active default for IPv4/IPv6
|
||||
$gateways = (new \OPNsense\Routing\Gateways())->setIfconfig(legacy_interfaces_details());
|
||||
$gateways = new \OPNsense\Routing\Gateways(legacy_interfaces_details());
|
||||
$default_gwv4 = $gateways->getDefaultGW(return_down_gateways(), "inet");
|
||||
$default_gwv6 = $gateways->getDefaultGW(return_down_gateways(), "inet6");
|
||||
$a_gateways = array_values($gateways->gatewaysIndexedByName(true, false, true));
|
||||
|
||||
@ -31,7 +31,7 @@ require_once("guiconfig.inc");
|
||||
require_once("services.inc");
|
||||
require_once("interfaces.inc");
|
||||
|
||||
$gateways = (new \OPNsense\Routing\Gateways())->setIfconfig(legacy_interfaces_details());
|
||||
$gateways = new \OPNsense\Routing\Gateways(legacy_interfaces_details());
|
||||
$a_gateways = array_values($gateways->gatewaysIndexedByName(true, false, true));
|
||||
$dpinger_default = return_dpinger_defaults();
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ require_once("system.inc");
|
||||
require_once("interfaces.inc");
|
||||
require_once("services.inc");
|
||||
|
||||
$a_gateways = (new \OPNsense\Routing\Gateways())->setIfconfig(legacy_interfaces_details())->gatewaysIndexedByName();
|
||||
$a_gateways = (new \OPNsense\Routing\Gateways(legacy_interfaces_details()))->gatewaysIndexedByName();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$pconfig = array();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user