Commit 7b07e6a5 authored by Franco Fichtner's avatar Franco Fichtner

plugins: introduce $verbose for plugins #1256

parent f16199ff
......@@ -162,7 +162,7 @@ function plugins_firewall($fw)
return $fw;
}
function plugins_configure()
function plugins_configure($verbose = true)
{
foreach (plugins_scan() as $name => $path) {
require_once $path;
......@@ -170,7 +170,7 @@ function plugins_configure()
if (function_exists($func)) {
$workers = $func();
foreach ($workers as $worker) {
$worker();
$worker($verbose);
}
}
}
......
......@@ -83,17 +83,6 @@ function miniupnpd_configure()
return array('miniupnpd_configure_do');
}
function miniupnpd_configure_do()
{
if (!miniupnpd_enabled()) {
return;
}
echo "Starting UPnP service...";
miniupnpd_sync_package();
echo "done.\n";
}
function miniupnpd_uuid()
{
/* md5 hash of wan mac */
......@@ -102,21 +91,30 @@ function miniupnpd_uuid()
return substr($uuid,0,8).'-'.substr($uuid,9,4).'-'.substr($uuid,13,4).'-'.substr($uuid,17,4).'-'.substr($uuid,21,12);
}
function miniupnpd_sync_package()
function miniupnpd_configure_do($verbose = false)
{
global $config;
global $input_errors;
if (!miniupnpd_enabled()) {
return;
}
if ($verbose) {
echo 'Starting UPnP service...';
flush();
}
$upnp_config = $config['installedpackages']['miniupnpd']['config'][0];
$config_file = '/var/etc/miniupnpd.conf';
$ext_ifname = get_real_interface($upnp_config['ext_iface']);
if ($ext_ifname == $upnp_config['ext_iface']) {
log_error("miniupnpd: Could not resolve real interface for {$upnp_config['ext_iface']}, exit");
if ($verbose) {
echo "failed.\n";
}
return;
}
$config_text = "ext_ifname={$ext_ifname}\n";
$config_text .= "port=2189\n";
......@@ -234,4 +232,8 @@ function miniupnpd_sync_package()
@unlink($config_file);
}
}
if ($verbose) {
echo "done.\n";
}
}
......@@ -193,7 +193,7 @@ filter_configure_sync(true);
/* Run all registered plugins */
if (function_exists('plugins_configure')) {
plugins_configure();
plugins_configure(true);
}
/* start IPsec tunnels */
......
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