From 87c2352d613c3a8c779346cbf7518265bf82ca43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=EF=BF=BD=EF=BF=BD?= Date: Wed, 4 Mar 2015 17:11:34 +0000 Subject: [PATCH] lower default TTL to 1 hour this actually raises availability when changes occur in the infrastructure and smooths transitions. 1 day TTLs was relevant back when DNS servers and traffic were much slower i do not think it is relevant anymore, and 1h seems much more reasonable --- bureau/class/m_dom.php | 4 ++-- install/mysql.sql | 2 +- install/upgrades/3.3.1.sql | 3 ++- phpunit/tests/_datasets/domaines.yml | 4 ++-- src/functions_dns.sh | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bureau/class/m_dom.php b/bureau/class/m_dom.php index 3afe4e18..64755f62 100644 --- a/bureau/class/m_dom.php +++ b/bureau/class/m_dom.php @@ -1501,7 +1501,7 @@ class m_dom { * TRUE sinon. * */ - function edit_domain($dom, $dns, $gesmx, $force = false, $ttl = 86400) { + function edit_domain($dom, $dns, $gesmx, $force = false, $ttl = 3600) { global $db, $err, $L_MX, $classes, $cuid, $hooks; $err->log("dom", "edit_domain", $dom . "/" . $dns . "/" . $gesmx); // Locked ? @@ -1528,7 +1528,7 @@ class m_dom { # Can't have ttl == 0. There is also a check in function_dns if ($ttl == 0) { - $ttl = 86400; + $ttl = 3600; } $t = checkfqdn($dom); diff --git a/install/mysql.sql b/install/mysql.sql index 69a92b2b..e6d63f50 100644 --- a/install/mysql.sql +++ b/install/mysql.sql @@ -115,7 +115,7 @@ CREATE TABLE IF NOT EXISTS domaines ( noerase tinyint(4) NOT NULL default '0', dns_action enum ('OK','UPDATE','DELETE') NOT NULL default 'UPDATE', dns_result varchar(255) not null default '', - zonettl int(10) unsigned NOT NULL default '86400', + zonettl int(10) unsigned NOT NULL default '3600', PRIMARY KEY (id), UNIQUE KEY (domaine) ) ENGINE=MyISAM; diff --git a/install/upgrades/3.3.1.sql b/install/upgrades/3.3.1.sql index f0a82698..b1017a0a 100644 --- a/install/upgrades/3.3.1.sql +++ b/install/upgrades/3.3.1.sql @@ -1,2 +1,3 @@ ALTER TABLE `actions` CHANGE `type` `type` ENUM('CREATE_FILE','FIX_USER','CREATE_DIR','DELETE','MOVE','FIX_DIR','FIX_FILE','CHMOD') DEFAULT NULL ; - +-- lower default TTL +ALTER TABLE `domaines` CHANGE `zonettl` `zonettl` int(10) unsigned NOT NULL default '3600'; diff --git a/phpunit/tests/_datasets/domaines.yml b/phpunit/tests/_datasets/domaines.yml index 06c44fff..302f0699 100644 --- a/phpunit/tests/_datasets/domaines.yml +++ b/phpunit/tests/_datasets/domaines.yml @@ -8,7 +8,7 @@ domaines: noerase : 0 dns_action : OK dns_result : 0 - zonettl : 86400 + zonettl : 3600 - id : 2 compte : 2001 @@ -18,4 +18,4 @@ domaines: noerase : 0 dns_action : OK dns_result : 0 - zonettl : 86400 + zonettl : 3600 diff --git a/src/functions_dns.sh b/src/functions_dns.sh index 84f31595..18453e3f 100755 --- a/src/functions_dns.sh +++ b/src/functions_dns.sh @@ -42,10 +42,10 @@ dns_get_zonettl() { ) # default value if [ "$zonettl" == "" ] ; then - zonettl="86400" + zonettl="3600" fi if [ "$zonettl" -eq "0" ] ; then - zonettl="86400" + zonettl="3600" fi echo $zonettl }