Commit e2a81419 authored by Ad Schellevis's avatar Ad Schellevis

(plugins) fix cleanup in plugins_interfaces()

parent 210d20f3
...@@ -53,6 +53,7 @@ function plugins_interfaces() ...@@ -53,6 +53,7 @@ function plugins_interfaces()
{ {
global $config; global $config;
$changed_interfaces = array(); $changed_interfaces = array();
$registered_interfaces = array();
// register / update interfaces // register / update interfaces
foreach (plugin_scan() as $name => $path) { foreach (plugin_scan() as $name => $path) {
...@@ -61,6 +62,9 @@ function plugins_interfaces() ...@@ -61,6 +62,9 @@ function plugins_interfaces()
if (function_exists($func)) { if (function_exists($func)) {
foreach ($func() as $intf_ref => $intf_data) { foreach ($func() as $intf_ref => $intf_data) {
if (is_array($intf_data)) { if (is_array($intf_data)) {
if (!in_array($intf_ref, $registered_interfaces)) {
$registered_interfaces[] = $intf_ref;
}
if (empty($config['interfaces'][$intf_ref])) { if (empty($config['interfaces'][$intf_ref])) {
$config['interfaces'][$intf_ref] = array(); $config['interfaces'][$intf_ref] = array();
} }
...@@ -82,7 +86,7 @@ function plugins_interfaces() ...@@ -82,7 +86,7 @@ function plugins_interfaces()
// cleanup registrations // cleanup registrations
foreach ($config['interfaces'] as $intf => $intf_data) { foreach ($config['interfaces'] as $intf => $intf_data) {
if (!empty($intf_data['internal_dynamic']) && !in_array($intf, $changed_interfaces)) { if (!empty($intf_data['internal_dynamic']) && !in_array($intf, $registered_interfaces)) {
$changed_interfaces[] = $intf; $changed_interfaces[] = $intf;
unset($config['interfaces'][$intf]); unset($config['interfaces'][$intf]);
} }
......
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