Commit 1d73b3b5 authored by Franco Fichtner's avatar Franco Fichtner

plugins: follow the footsteps of plugins_syslog() and plugins_services()

This looks simple enough now.  Discussed with @adschellevis.
parent 74870bbf
...@@ -177,9 +177,15 @@ function write_config($desc = '', $backup = true) ...@@ -177,9 +177,15 @@ function write_config($desc = '', $backup = true)
return -1; return -1;
} }
if (function_exists('plugins_interfaces')) {
/* only pull plugins if plugins.inc was included before */
plugins_interfaces(false);
}
$cnf = OPNsense\Core\Config::getInstance(); $cnf = OPNsense\Core\Config::getInstance();
$cnf->fromArray($config); $cnf->fromArray($config);
$revision_info = make_config_revision_entry($desc); $revision_info = make_config_revision_entry($desc);
try { try {
$cnf->save($revision_info, $backup); $cnf->save($revision_info, $backup);
} catch (OPNsense\Core\ConfigException $e) { } catch (OPNsense\Core\ConfigException $e) {
......
...@@ -732,7 +732,6 @@ function step12_submitphpaction() ...@@ -732,7 +732,6 @@ function step12_submitphpaction()
$config['openvpn']['openvpn-server'][] = $server; $config['openvpn']['openvpn-server'][] = $server;
openvpn_resync('server', $server); openvpn_resync('server', $server);
plugins_interfaces(false);
write_config(); write_config();
header("Location: vpn_openvpn_server.php"); header("Location: vpn_openvpn_server.php");
exit; exit;
......
...@@ -53,7 +53,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -53,7 +53,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
} }
unset($a_ifgroups[$id]); unset($a_ifgroups[$id]);
plugins_interfaces(false);
write_config(); write_config();
header("Location: interfaces_groups.php"); header("Location: interfaces_groups.php");
exit; exit;
......
...@@ -125,7 +125,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -125,7 +125,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// add new item // add new item
$a_ifgroups[] = $ifgroupentry; $a_ifgroups[] = $ifgroupentry;
} }
plugins_interfaces(false);
write_config(); write_config();
interface_group_setup($ifgroupentry); interface_group_setup($ifgroupentry);
header("Location: interfaces_groups.php"); header("Location: interfaces_groups.php");
......
...@@ -88,7 +88,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -88,7 +88,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} elseif (isset($config['ipsec']['enable'])) { } elseif (isset($config['ipsec']['enable'])) {
unset($config['ipsec']['enable']); unset($config['ipsec']['enable']);
} }
plugins_interfaces(false);
write_config(); write_config();
ipsec_configure(); ipsec_configure();
filter_configure(); filter_configure();
...@@ -118,7 +117,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -118,7 +117,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
unset($config['ipsec']['phase1'][$p1entrydel]); unset($config['ipsec']['phase1'][$p1entrydel]);
} }
plugins_interfaces(false);
write_config(); write_config();
mark_subsystem_dirty('ipsec'); mark_subsystem_dirty('ipsec');
header("Location: vpn_ipsec.php"); header("Location: vpn_ipsec.php");
......
...@@ -170,10 +170,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -170,10 +170,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$config['ipsec']['client'] = $client; $config['ipsec']['client'] = $client;
plugins_interfaces(false);
write_config(); write_config();
mark_subsystem_dirty('ipsec'); mark_subsystem_dirty('ipsec');
header(url_safe('Location: vpn_ipsec_mobile.php')); header(url_safe('Location: vpn_ipsec_mobile.php'));
exit; exit;
} }
......
...@@ -387,7 +387,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -387,7 +387,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} }
} }
plugins_interfaces(false);
write_config(); write_config();
mark_subsystem_dirty('ipsec'); mark_subsystem_dirty('ipsec');
header("Location: vpn_ipsec.php"); header("Location: vpn_ipsec.php");
......
...@@ -135,7 +135,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -135,7 +135,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (isset($id)) { if (isset($id)) {
openvpn_delete('client', $a_client[$id]); openvpn_delete('client', $a_client[$id]);
unset($a_client[$id]); unset($a_client[$id]);
plugins_interfaces(false);
write_config(); write_config();
} }
header("Location: vpn_openvpn_client.php"); header("Location: vpn_openvpn_client.php");
...@@ -148,7 +147,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -148,7 +147,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset($a_client[$rulei]); unset($a_client[$rulei]);
} }
} }
plugins_interfaces(false);
write_config(); write_config();
} }
header("Location: vpn_openvpn_client.php"); header("Location: vpn_openvpn_client.php");
...@@ -339,7 +337,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -339,7 +337,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} }
openvpn_resync('client', $client); openvpn_resync('client', $client);
plugins_interfaces(false);
write_config(); write_config();
header("Location: vpn_openvpn_client.php"); header("Location: vpn_openvpn_client.php");
......
...@@ -139,7 +139,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -139,7 +139,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (isset($a_server[$id])) { if (isset($a_server[$id])) {
openvpn_delete('server', $a_server[$id]); openvpn_delete('server', $a_server[$id]);
unset($a_server[$id]); unset($a_server[$id]);
plugins_interfaces(false);
write_config(); write_config();
} }
header("Location: vpn_openvpn_server.php"); header("Location: vpn_openvpn_server.php");
...@@ -404,7 +403,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -404,7 +403,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} }
openvpn_resync('server', $server); openvpn_resync('server', $server);
plugins_interfaces(false);
write_config(); write_config();
openvpn_resync_csc(); // dump client specific overrides, the required set may have changed openvpn_resync_csc(); // dump client specific overrides, the required set may have changed
......
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