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