mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 11:26:13 +00:00
dyndns/rfc2136: proper enabled helper
This commit is contained in:
parent
66de2bde0e
commit
d51dd4adf1
@ -41,11 +41,28 @@ function dyndns_configure()
|
||||
);
|
||||
}
|
||||
|
||||
function dyndns_enabled()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($config['dyndnses']['dyndns'])) {
|
||||
foreach ($config['dyndnses']['dyndns'] as $conf) {
|
||||
if (isset($conf['enable'])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function dyndns_cron()
|
||||
{
|
||||
$jobs = array();
|
||||
|
||||
$jobs[]['autocron'] = array('/usr/local/etc/rc.dyndns.update', '11', '1');
|
||||
if (dyndns_enabled()) {
|
||||
$jobs[]['autocron'] = array('/usr/local/etc/rc.dyndns.update', '11', '1');
|
||||
}
|
||||
|
||||
return $jobs;
|
||||
}
|
||||
@ -119,15 +136,12 @@ function dyndns_configure_do($verbose = false, $int = '')
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (!isset($config['dyndnses']['dyndns'])) {
|
||||
if (!dyndns_enabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$dyndnscfg = $config['dyndnses']['dyndns'];
|
||||
$gwgroups = return_gateway_groups_array();
|
||||
if (!is_array($dyndnscfg)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($verbose) {
|
||||
echo 'Configuring dynamic DNS clients...';
|
||||
|
||||
@ -42,8 +42,15 @@ function rfc2136_enabled()
|
||||
{
|
||||
global $config;
|
||||
|
||||
/* XXX not entirely correct */
|
||||
return isset($config['dnsupdates']['dnsupdate']);
|
||||
if (isset($config['dnsupdates']['dnsupdate'])) {
|
||||
foreach ($config['dnsupdates']['dnsupdate'] as $dnsupdate) {
|
||||
if (isset($dnsupdate['enable'])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function rfc2136_cron()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user