Commit 64617a98 authored by Franco Fichtner's avatar Franco Fichtner

plugins: not going away anytime soon

If we want to be pluggable, simply delete contents of
/usr/local/etc/inc/plugins.inc.d/ and be done with it.

(cherry picked from commit bdd1be39)
parent 4afd8442
...@@ -57,10 +57,9 @@ require_once("certs.inc"); ...@@ -57,10 +57,9 @@ require_once("certs.inc");
/* /*
* Hook up the plugin system which consists of several low-profile * Hook up the plugin system which consists of several low-profile
* functions that can be called from within our backend code when * functions that can be called from within our backend code when
* they exist. The magic here is that if the plugin system is not * they exist.
* required it can be completely disabled by removing plugins.inc.
*/ */
include_once('plugins.inc'); require_once('plugins.inc');
/* make a global alias table (for faster lookups) */ /* make a global alias table (for faster lookups) */
function alias_make_table($config) function alias_make_table($config)
...@@ -199,9 +198,7 @@ function write_config($desc = '', $backup = true) ...@@ -199,9 +198,7 @@ function write_config($desc = '', $backup = true)
return -1; return -1;
} }
if (function_exists('plugins_interfaces')) { plugins_interfaces();
plugins_interfaces();
}
$cnf = OPNsense\Core\Config::getInstance(); $cnf = OPNsense\Core\Config::getInstance();
$cnf->fromArray($config); $cnf->fromArray($config);
......
...@@ -388,9 +388,7 @@ function filter_configure_sync($verbose = false) ...@@ -388,9 +388,7 @@ function filter_configure_sync($verbose = false)
$fw->setInterfaceMapping(legacy_config_get_interfaces(array("enable" => true))); $fw->setInterfaceMapping(legacy_config_get_interfaces(array("enable" => true)));
filter_core_bootstrap($fw); filter_core_bootstrap($fw);
if (function_exists('plugins_firewall')) { plugins_firewall($fw);
plugins_firewall($fw);
}
/* Use filter lock to not allow concurrent filter reloads during this run. */ /* Use filter lock to not allow concurrent filter reloads during this run. */
$filterlck = lock('filter', LOCK_EX); $filterlck = lock('filter', LOCK_EX);
......
...@@ -1935,10 +1935,8 @@ function services_get() ...@@ -1935,10 +1935,8 @@ function services_get()
'name' => 'configd', 'name' => 'configd',
); );
if (function_exists('plugins_services')) { foreach (plugins_services() as $service) {
foreach (plugins_services() as $service) { $services[] = $service;
$services[] = $service;
}
} }
uasort($services, function ($a, $b) { uasort($services, function ($a, $b) {
......
...@@ -749,10 +749,8 @@ function system_syslogd_start($verbose = false) ...@@ -749,10 +749,8 @@ function system_syslogd_start($verbose = false)
$syslogconfs = array(); $syslogconfs = array();
if (function_exists('plugins_syslog')) { foreach (plugins_syslog() as $plugin_name => $plugin_details) {
foreach (plugins_syslog() as $plugin_name => $plugin_details) { $syslogconfs[$plugin_name] = $plugin_details;
$syslogconfs[$plugin_name] = $plugin_details;
}
} }
/* /*
......
...@@ -141,9 +141,7 @@ function filter_configure_xmlrpc() ...@@ -141,9 +141,7 @@ function filter_configure_xmlrpc()
services_dhcpd_configure(); services_dhcpd_configure();
openvpn_resync_all(); openvpn_resync_all();
if (function_exists('plugins_configure')) { plugins_configure('remote');
plugins_configure('remote');
}
return true; return true;
} }
......
...@@ -139,9 +139,7 @@ mwexec("/usr/local/etc/rc.dyndns.update"); /* XXX convert to plugin */ ...@@ -139,9 +139,7 @@ mwexec("/usr/local/etc/rc.dyndns.update"); /* XXX convert to plugin */
prefer_ipv4_or_ipv6(); prefer_ipv4_or_ipv6();
filter_configure_sync(true); filter_configure_sync(true);
if (function_exists('plugins_configure')) { plugins_configure('bootup', true);
plugins_configure('bootup', true);
}
/* start IPsec tunnels */ /* start IPsec tunnels */
$ipsec_dynamic_hosts = ipsec_configure(true); $ipsec_dynamic_hosts = ipsec_configure(true);
......
...@@ -287,10 +287,8 @@ if (isset($config['hasync']) && is_array($config['hasync'])) { ...@@ -287,10 +287,8 @@ if (isset($config['hasync']) && is_array($config['hasync'])) {
$section_cnf['synchronizeauthservers'] = 'system.authserver'; $section_cnf['synchronizeauthservers'] = 'system.authserver';
$section_cnf['synchronizeschedules'] = 'schedules'; $section_cnf['synchronizeschedules'] = 'schedules';
if (function_exists('plugins_xmlrpc_sync')) { foreach (plugins_xmlrpc_sync() as $syncid => $syncconf) {
foreach (plugins_xmlrpc_sync() as $syncid => $syncconf) { $section_cnf['synchronize'.$syncid] = $syncconf['section'];
$section_cnf['synchronize'.$syncid] = $syncconf['section'];
}
} }
$sections = array(); $sections = array();
...@@ -307,7 +305,6 @@ if (isset($config['hasync']) && is_array($config['hasync'])) { ...@@ -307,7 +305,6 @@ if (isset($config['hasync']) && is_array($config['hasync'])) {
exit; exit;
} }
$username = empty($hasync['username']) ? "root" : $hasync['username']; $username = empty($hasync['username']) ? "root" : $hasync['username'];
if (!carp_check_version($synchronizeto, $username, $hasync['password'])) { if (!carp_check_version($synchronizeto, $username, $hasync['password'])) {
exit; exit;
......
...@@ -203,9 +203,7 @@ if (!is_ipaddr($oldip) || $curwanip != $oldip || !is_ipaddrv4($config['interface ...@@ -203,9 +203,7 @@ if (!is_ipaddr($oldip) || $curwanip != $oldip || !is_ipaddrv4($config['interface
enable_rrd_graphing(); enable_rrd_graphing();
/* reload plugins */ /* reload plugins */
if (function_exists('plugins_configure')) { plugins_configure('interface');
plugins_configure('interface');
}
} }
/* reload filter, don't try to sync to carp slave */ /* reload filter, don't try to sync to carp slave */
......
...@@ -161,6 +161,4 @@ if (substr($interface_real, 0, 4) != 'ovpn') { ...@@ -161,6 +161,4 @@ if (substr($interface_real, 0, 4) != 'ovpn') {
enable_rrd_graphing(); enable_rrd_graphing();
/* reload plugins */ /* reload plugins */
if (function_exists('plugins_configure')) { plugins_configure('interface');
plugins_configure('interface');
}
...@@ -67,10 +67,11 @@ system_cron_configure(true); ...@@ -67,10 +67,11 @@ system_cron_configure(true);
mwexec_bg('/usr/local/etc/rc.sshd'); mwexec_bg('/usr/local/etc/rc.sshd');
if (function_exists('plugins_configure')) { log_error("rc.reload_all: Reloading all plugin settings.");
log_error("rc.reload_all: Reloading all plugin settings.");
plugins_configure('local', true); plugins_configure('local', true);
}
log_error("rc.reload_all: Reloading RRD graphing");
enable_rrd_graphing(true); enable_rrd_graphing(true);
......
...@@ -524,9 +524,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -524,9 +524,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} }
} }
/* restart plugins */ /* restart plugins */
if (function_exists('plugins_configure')) { plugins_configure('interface');
plugins_configure('interface');
}
/* sync filter configuration */ /* sync filter configuration */
setup_gateways_monitor(); setup_gateways_monitor();
filter_configure(); filter_configure();
......
...@@ -49,11 +49,7 @@ $checkbox_names = array( ...@@ -49,11 +49,7 @@ $checkbox_names = array(
'synchronizevirtualip', 'synchronizevirtualip',
); );
$syncplugins = array(); $syncplugins = plugins_xmlrpc_sync();
if (function_exists('plugins_xmlrpc_sync')) {
$syncplugins = plugins_xmlrpc_sync();
}
foreach (array_keys($syncplugins) as $key) { foreach (array_keys($syncplugins) as $key) {
$checkbox_names[] = 'synchronize'.$key; $checkbox_names[] = 'synchronize'.$key;
......
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