Fixing existing DynDNS force-update feature. Redmine bug #2228

This commit is contained in:
Yehuda Katz 2012-02-22 20:02:09 -05:00
parent 40ce0d68ed
commit f3b2b2a42c
4 changed files with 13 additions and 14 deletions

View File

@ -94,7 +94,7 @@
*/
function updatedns ($dnsService = '', $dnsHost = '', $dnsUser = '', $dnsPass = '',
$dnsWildcard = 'OFF', $dnsMX = '', $dnsIf = '', $dnsBackMX = '',
$dnsServer = '', $dnsPort = '', $dnsUpdateURL = '') {
$dnsServer = '', $dnsPort = '', $dnsUpdateURL = '', $forceUpdate = false) {
global $config, $g;
@ -140,7 +140,7 @@
$this->_debugID = rand(1000000, 9999999);
if ($this->_detectChange() == false) {
if ($forceUpdate == false && $this->_detectChange() == false) {
$this->_error(10);
} else {
switch ($this->_dnsService) {

View File

@ -1309,8 +1309,12 @@ function services_dyndns_configure_client($conf) {
$dnsPass = $conf['password'],
$dnsWilcard = $conf['wildcard'],
$dnsMX = $conf['mx'],
$dnsIf = "{$conf['interface']}");
$dnsIf = "{$conf['interface']}",
$dnsBackMX = NULL,
$dnsServer = NULL,
$dnsPort = NULL,
$dnsUpdateURL = NULL,
$forceUpdate = $conf['force']);
}
function services_dyndns_configure($int = "") {

View File

@ -159,7 +159,8 @@ include("head.inc");
<td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
<?=gettext("Note:");?><br>
</strong></span>
<?=gettext("IP addresses appearing in green are up to date with Dynamic DNS provider.");?>
<?=gettext("IP addresses appearing in green are up to date with Dynamic DNS provider.");?><br>
<?=gettext("You can force an update for an IP address on the edit page for that service.");?>
</td>
<td class="list">&nbsp;</td>
</tr>

View File

@ -104,6 +104,7 @@ if ($_POST) {
$dyndns['enable'] = $_POST['enable'] ? false : true;
$dyndns['interface'] = $_POST['interface'];
$dyndns['descr'] = $_POST['descr'];
$dyndns['force'] = isset($_POST['force']);
if($dyndns['username'] == "none")
$dyndns['username'] = "";
@ -115,15 +116,7 @@ if ($_POST) {
write_config();
$retval = 0;
conf_mount_rw();
unlink("{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}{$dyndns['host']}.cache");
$retval = services_dyndns_configure_client($dyndns);
conf_mount_ro();
services_dyndns_configure_client($dyndns);
header("Location: services_dyndns.php");
exit;
@ -237,6 +230,7 @@ include("head.inc");
<a href="services_dyndns.php"><input name="cancel" type="button" class="formbtn" value="<?=gettext("Cancel");?>"></a>
<?php if (isset($id) && $a_dyndns[$id]): ?>
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>">
<input name="force" type="submit" class="formbtn" value="<?=gettext("Save & Force Update");?>" onClick="enable_change(true)">
<?php endif; ?>
</td>
</tr>