Commit f90e96f2 authored by Franco Fichtner's avatar Franco Fichtner

universal plug and play: move functions to their file

services.inc already includes unbound.inc and miniupnpd.inc so
it's safe to do this...
parent 79edae2c
<?php <?php
/* MiniUPnPd */
function upnp_notice ($msg) { log_error("miniupnpd: {$msg}"); } function upnp_notice ($msg) { log_error("miniupnpd: {$msg}"); }
function upnp_warn ($msg) { log_error("miniupnpd: {$msg}"); } function upnp_warn ($msg) { log_error("miniupnpd: {$msg}"); }
...@@ -12,6 +9,36 @@ function upnp_running () { ...@@ -12,6 +9,36 @@ function upnp_running () {
return false; return false;
} }
function upnp_start()
{
if (file_exists('/var/etc/miniupnpd.conf')) {
@unlink('/var/run/miniupnpd.pid');
mwexec_bg('/usr/local/sbin/miniupnpd -f /var/etc/miniupnpd.conf -P /var/run/miniupnpd.pid');
}
}
function upnp_stop()
{
killbypid('/var/run/miniupnpd.pid');
while((int)exec("/bin/pgrep -a miniupnpd | wc -l") > 0) {
mwexec('killall miniupnpd 2>/dev/null', true);
}
mwexec('/sbin/pfctl -aminiupnpd -Fr 2>&1 >/dev/null');
mwexec('/sbin/pfctl -aminiupnpd -Fn 2>&1 >/dev/null');
}
function upnp_configure()
{
global $config;
if (!empty($config['installedpackages']['miniupnpd']['config'][0]['enable'])) {
echo gettext("Starting UPnP service... ");
sync_package_miniupnpd();
echo "done.\n";
}
}
function upnp_write_config($file, $text) { function upnp_write_config($file, $text) {
$handle = fopen($file, 'w'); $handle = fopen($file, 'w');
if(!$handle) { if(!$handle) {
......
...@@ -2431,35 +2431,6 @@ function configure_cron() ...@@ -2431,35 +2431,6 @@ function configure_cron()
killbypid('/var/run/cron.pid', 'HUP'); killbypid('/var/run/cron.pid', 'HUP');
} }
function upnp_start()
{
if (file_exists('/var/etc/miniupnpd.conf')) {
@unlink('/var/run/miniupnpd.pid');
mwexec_bg('/usr/local/sbin/miniupnpd -f /var/etc/miniupnpd.conf -P /var/run/miniupnpd.pid');
}
}
function upnp_stop()
{
killbypid('/var/run/miniupnpd.pid');
while((int)exec("/bin/pgrep -a miniupnpd | wc -l") > 0) {
mwexec('killall miniupnpd 2>/dev/null', true);
}
mwexec('/sbin/pfctl -aminiupnpd -Fr 2>&1 >/dev/null');
mwexec('/sbin/pfctl -aminiupnpd -Fn 2>&1 >/dev/null');
}
function upnp_configure()
{
global $config;
if (!empty($config['installedpackages']['miniupnpd']['config'][0]['enable'])) {
echo gettext("Starting UPnP service... ");
sync_package_miniupnpd();
echo "done.\n";
}
}
function install_cron_job($command, $active=false, $minute="0", $hour="*", $monthday="*", $month="*", $weekday="*", $who="root") { function install_cron_job($command, $active=false, $minute="0", $hour="*", $monthday="*", $month="*", $weekday="*", $who="root") {
global $config; global $config;
......
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