aboutsummaryrefslogtreecommitdiffstats
path: root/packages/tinydns
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2008-10-24 17:40:38 +0000
committerScott Ullrich <sullrich@pfsense.org>2008-10-24 17:40:38 +0000
commit7718003a1846b9e78c2d3afefacccd0084e5201e (patch)
treecd999effa28493dadc1584935da32599436fca8e /packages/tinydns
parent21cfa61cde0eeb323a58324b8bd79382d263c300 (diff)
downloadpfsense-packages-7718003a1846b9e78c2d3afefacccd0084e5201e.tar.gz
pfsense-packages-7718003a1846b9e78c2d3afefacccd0084e5201e.tar.bz2
pfsense-packages-7718003a1846b9e78c2d3afefacccd0084e5201e.zip
Add a automatically sync field (checkbox)
Diffstat (limited to 'packages/tinydns')
-rw-r--r--packages/tinydns/tinydns.inc14
-rw-r--r--packages/tinydns/tinydns.xml5
-rw-r--r--packages/tinydns/tinydns_domains.xml3
-rw-r--r--packages/tinydns/tinydns_sync.xml8
4 files changed, 29 insertions, 1 deletions
diff --git a/packages/tinydns/tinydns.inc b/packages/tinydns/tinydns.inc
index 749fa92d..4f73eee7 100644
--- a/packages/tinydns/tinydns.inc
+++ b/packages/tinydns/tinydns.inc
@@ -429,6 +429,20 @@ function tinydns_create_zone_file() {
conf_mount_ro();
}
+function tinydns_sync_on_changes() {
+ global $g, $config;
+ $synconchanges = $config['installedpackages']['tinydns']['config'][0]['synconchanges'];
+ if(!$synconchanges)
+ return;
+ $sync_hosts = $config['installedpackages']['tinydnssync']['config'];
+ foreach($sync_hosts as $sh) {
+ $sync_to_ip = $sh['ipaddress'];
+ $password = $sh['password'];
+ if($password and $sync_to_ip)
+ tinydns_do_xmlrpc_sync($sync_to_ip, $password);
+ }
+}
+
function tinydns_do_xmlrpc_sync($sync_to_ip, $password) {
global $config, $g;
diff --git a/packages/tinydns/tinydns.xml b/packages/tinydns/tinydns.xml
index 25c43340..5538bfad 100644
--- a/packages/tinydns/tinydns.xml
+++ b/packages/tinydns/tinydns.xml
@@ -223,23 +223,28 @@
tinydns_custom_php_install_command();
tinydns_create_zone_file();
tinydns_setup_ping_items();
+ tinydns_sync_on_changes();
</custom_delete_php_command>
<custom_add_php_command>
tinydns_custom_php_changeip_command();
tinydns_custom_php_install_command();
tinydns_create_zone_file();
tinydns_setup_ping_items();
+ tinydns_sync_on_changes();
</custom_add_php_command>
<custom_php_resync_config_command>
tinydns_custom_php_changeip_command();
tinydns_custom_php_install_command();
tinydns_create_zone_file();
tinydns_setup_ping_items();
+ tinydns_sync_on_changes();
</custom_php_resync_config_command>
<custom_php_install_command>
tinydns_custom_php_install_command();
+ tinydns_sync_on_changes();
</custom_php_install_command>
<custom_php_deinstall_command>
tinydns_custom_php_deinstall_command();
+ tinydns_sync_on_changes();
</custom_php_deinstall_command>
</packagegui>
diff --git a/packages/tinydns/tinydns_domains.xml b/packages/tinydns/tinydns_domains.xml
index d22defd3..11779c53 100644
--- a/packages/tinydns/tinydns_domains.xml
+++ b/packages/tinydns/tinydns_domains.xml
@@ -195,6 +195,7 @@
<custom_delete_php_command>
tinydns_create_zone_file();
tinydns_setup_ping_items();
+ tinydns_sync_on_changes();
</custom_delete_php_command>
<custom_add_php_command>
log_error("Begin tinydns add");
@@ -202,6 +203,7 @@
log_error("Zone file done.");
tinydns_setup_ping_items();
log_error("Ping items done.");
+ tinydns_sync_on_changes();
</custom_add_php_command>
<custom_php_resync_config_command>
log_error("Begin tinydns resync");
@@ -209,5 +211,6 @@
log_error("Zone file done.");
tinydns_setup_ping_items();
log_error("Ping items done.");
+ tinydns_sync_on_changes();
</custom_php_resync_config_command>
</packagegui>
diff --git a/packages/tinydns/tinydns_sync.xml b/packages/tinydns/tinydns_sync.xml
index 39633907..68265cf3 100644
--- a/packages/tinydns/tinydns_sync.xml
+++ b/packages/tinydns/tinydns_sync.xml
@@ -79,6 +79,12 @@
<configpath>installedpackages->package->tinydns</configpath>
<fields>
<field>
+ <fielddescr>Automatically sync on changes</fielddescr>
+ <fieldname>synconchanges</fieldname>
+ <description>pfSense will automatically sync changes to hosts defined in the Sync tab.</description>
+ <type>checkbox</type>
+ </field>
+ <field>
<fielddescr>IP Address</fielddescr>
<fieldname>ipaddress</fieldname>
<description>The IP address that TinyDNS will Sync its data to.</description>
@@ -118,7 +124,7 @@
<custom_php_resync_config_command>
tinydns_do_xmlrpc_sync($_POST['ipaddress'], $_POST['password']);
if($_POST['ipaddress2'])
- tinydns_do_xmlrpc_sync($_POST['ipaddress2'], $_POST['password2']);
+ tinydns_do_xmlrpc_syncc_sync($_POST['ipaddress2'], $_POST['password2']);
if($_POST['ipaddress3'])
tinydns_do_xmlrpc_sync($_POST['ipaddress3'], $_POST['password3']);
</custom_php_resync_config_command>