Commit e6d7a121 authored by Franco Fichtner's avatar Franco Fichtner

plugins: add hooks for services

(cherry picked from commit 9709336b)
parent e23a462e
......@@ -49,6 +49,24 @@ function plugin_scan()
return $ret;
}
function plugins_services()
{
$services = array();
foreach (plugin_scan() as $name => $path) {
require_once $path;
$func = sprintf('%s_services', $name);
if (function_exists($func)) {
$workers = $func();
foreach ($workers as $work) {
$services[] = $work;
}
}
}
return $services;
}
function plugins_configure()
{
foreach (plugin_scan() as $name => $path) {
......
......@@ -38,6 +38,23 @@ function vpn_configure()
);
}
function vpn_services()
{
global $config;
$services = array();
if (isset($config['pptpd']['mode']) && $config['pptpd']['mode'] == 'server') {
$pconfig = array();
$pconfig['name'] = 'pptpd';
$pconfig['description'] = gettext('PPTP Server');
$pconfig['pidfile'] = '/var/run/pptp-vpn.pid';
$services[] = $pconfig;
}
return $services;
}
function vpn_netgraph_support() {
$iflist = get_configured_interface_list();
foreach ($iflist as $iface) {
......
......@@ -2754,6 +2754,13 @@ function find_service_by_name($names, $filter = array())
$services = services_get();
if (function_exists('plugins_services')) {
/* only pull plugins if plugins.inc was included before */
foreach (plugins_services() as $service) {
$services[] = $service;
}
}
foreach ($services as $service) {
foreach ($names as $name) {
if ($service['name'] != $name) {
......
......@@ -19,4 +19,7 @@ $tab_array = array();
$tab_array[] = array(gettext("PPTP Logins"), $mode != "raw", "/diag_logs_pptp.php");
$tab_array[] = array(gettext("PPTP Raw"), $mode == "raw", "/diag_logs_pptp.php?mode=raw");
require_once 'services.inc';
$service_hook = 'pptpd';
require_once 'diag_logs_vpn.inc';
......@@ -30,8 +30,9 @@
require_once('guiconfig.inc');
require_once('interfaces.inc');
require_once('filter.inc');
require_once('plugins.inc.d/vpn.inc');
require_once('services.inc');
require_once("pfsense-utils.inc");
require_once('plugins.inc.d/vpn.inc');
if (!is_array($config['pptpd']['radius'])) {
$config['pptpd']['radius'] = array();
......@@ -193,6 +194,8 @@ if ($_POST) {
}
}
$service_hook = 'pptpd';
include("head.inc");
?>
......
......@@ -28,6 +28,7 @@
*/
require_once('guiconfig.inc');
require_once('services.inc');
require_once('plugins.inc.d/vpn.inc');
if (!is_array($config['pptpd']['user'])) {
......@@ -55,6 +56,8 @@ if ($_GET['act'] == "del") {
}
}
$service_hook = 'pptpd';
include("head.inc");
$main_buttons = array(
......
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