Skip to content

Commit 86138ed

Browse files
author
Till Brehm
committed
Fixed #4769 ISPConfig-3.1.6: mydns_to_powerdns_migration.php not handling apex records correctly
1 parent 94f41e3 commit 86138ed

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

helper_scripts/mydns_to_powerdns_migration.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,28 @@
3131
{
3232
$file2=$row2['data'];
3333
}
34+
35+
//
36+
// Fix for 'domain.ext.' apex notation
37+
//
38+
$record_name_end=substr($row2['name'], -1);
39+
if ($record_name_end==".")
40+
{
41+
// remove trailing dot from apex
42+
$record_name = substr($row2['name'], 0, strlen($row2['name'])-1);
43+
}
44+
else
45+
{
46+
// add domain to make it a fqdn
47+
$record_name = $row2['name'] . "." . $row3['origin'];
48+
}
49+
50+
print "$row2[name].$row3[origin]" . " $record_name\r\n";
3451
mysql_select_db("dbispconfig");
3552
$sql3 = mysql_query("SELECT substr(origin,1, LENGTH(origin)-1) AS origin FROM dns_soa where id=$row2[zone];");
3653
$row3 = mysql_fetch_array($sql3);
3754
mysql_select_db("powerdns");
38-
mysql_query("INSERT INTO records (domain_id,name,content,ispconfig_id,type,ttl,prio,change_date) values ('$row2[zone]','$row2[name].$row3[origin]','$file2','$row2[id]','$row2[type]','$row2[ttl]','$row2[aux]','1260446221');");
55+
mysql_query("INSERT INTO records (domain_id,name,content,ispconfig_id,type,ttl,prio,change_date) values ('$row2[zone]','$record_name','$file2','$row2[id]','$row2[type]','$row2[ttl]','$row2[aux]','1260446221');");
3956
}
4057
else
4158
{

0 commit comments

Comments
 (0)