Commit 927f4e0e authored by Franco Fichtner's avatar Franco Fichtner

plugins: do not call write_config() in plugins_interfaces()

Since we weaved the latter into the former, we can now get rid of
the transition code.  The behaviour doesn't change.
parent 143e759f
...@@ -179,7 +179,7 @@ function write_config($desc = '', $backup = true) ...@@ -179,7 +179,7 @@ function write_config($desc = '', $backup = true)
if (function_exists('plugins_interfaces')) { if (function_exists('plugins_interfaces')) {
/* only pull plugins if plugins.inc was included before */ /* only pull plugins if plugins.inc was included before */
plugins_interfaces(false); plugins_interfaces();
} }
$cnf = OPNsense\Core\Config::getInstance(); $cnf = OPNsense\Core\Config::getInstance();
......
...@@ -94,12 +94,11 @@ function plugins_syslog() ...@@ -94,12 +94,11 @@ function plugins_syslog()
* Every <plugin>_interface should return a named array containing the interface unique identifier and properties. * Every <plugin>_interface should return a named array containing the interface unique identifier and properties.
* *
*/ */
function plugins_interfaces($write_allowed = true) function plugins_interfaces()
{ {
global $config; global $config;
$stale_interfaces = array(); $stale_interfaces = array();
$write_required = false;
// mark previous dynamic registrations stale // mark previous dynamic registrations stale
if (isset($config['interfaces'])) { if (isset($config['interfaces'])) {
...@@ -135,7 +134,6 @@ function plugins_interfaces($write_allowed = true) ...@@ -135,7 +134,6 @@ function plugins_interfaces($write_allowed = true)
foreach ($intf_data as $prop_name => $prop_value) { foreach ($intf_data as $prop_name => $prop_value) {
if ((empty($intf_config[$prop_name]) && !empty($prop_value)) || $intf_config[$prop_name] != $prop_value) { if ((empty($intf_config[$prop_name]) && !empty($prop_value)) || $intf_config[$prop_name] != $prop_value) {
$intf_config[$prop_name] = $prop_value; $intf_config[$prop_name] = $prop_value;
$write_required = true;
} }
} }
} }
...@@ -147,14 +145,8 @@ function plugins_interfaces($write_allowed = true) ...@@ -147,14 +145,8 @@ function plugins_interfaces($write_allowed = true)
foreach ($stale_interfaces as $intf_ref => $no_data) { foreach ($stale_interfaces as $intf_ref => $no_data) {
if (isset($config['interfaces'][$intf_ref])) { if (isset($config['interfaces'][$intf_ref])) {
unset($config['interfaces'][$intf_ref]); unset($config['interfaces'][$intf_ref]);
$write_required = true;
} }
} }
// configuration changed, materialize
if ($write_allowed && $write_required) {
write_config();
}
} }
function plugins_configure() function plugins_configure()
......
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