Commit d51dd4ad authored by Franco Fichtner's avatar Franco Fichtner

dyndns/rfc2136: proper enabled helper

parent 66de2bde
......@@ -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()
......
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