mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 00:54:41 +00:00
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...
This commit is contained in:
parent
79edae2ce8
commit
f90e96f243
@ -1,8 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
/* MiniUPnPd */
|
||||
|
||||
function upnp_notice ($msg) { log_error("miniupnpd: {$msg}"); }
|
||||
function upnp_warn ($msg) { log_error("miniupnpd: {$msg}"); }
|
||||
|
||||
@ -12,6 +9,36 @@ function upnp_running () {
|
||||
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) {
|
||||
$handle = fopen($file, 'w');
|
||||
if(!$handle) {
|
||||
|
||||
@ -2431,35 +2431,6 @@ function configure_cron()
|
||||
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") {
|
||||
global $config;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user