-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a check for A or AAAA record #196
base: master
Are you sure you want to change the base?
Conversation
Add a check for A or AAAA record, they could have the same hostname
For people who use other nameservers than the zpanel default it would be better to name the SOA as the first added namserver.
if (count($dbresult)) { | ||
foreach($dbresult as $row) { | ||
if(($row['dn_type_vc'] == 'A' && $type[$NewId] == 'AAAA') OR ($row['dn_type_vc'] == 'AAAA' && $type[$NewId] == 'A')) { | ||
$exists = ($exists ? true : false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$exists = ($exists ? true : false); does exactely ... nothing !
I'm afraid that there is something to redesign here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a loop through all records. If there is a record wich exists $exists = true, but if the next record not is the same the $exists will not be reset to false because it is already true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With $exists = ($exists ? true : false);
- If $exists is true, it will turned to true,
- if $exists is false, it wll be turned to false.
=> $exists will never change (by this line), so the test and the loop have no sense !
did you want to enable both A and AAAA record for the same domain ?
It would be better to change only the query, something like :
$numrows = $zdbh->prepare('SELECT dn_id_pk FROM x_dns WHERE dn_host_vc=:hostName2 AND dn_vhost_fk=:domainID AND dn_type_vc<>:excludetype AND dn_deleted_ts IS NULL');
$hostName2 = $hostName[$NewId];
$numrows->bindParam(':hostName2', $hostName2);
$numrows->bindParam(':domainID', $domainID);
$numrows->bindParam(':excludetype', ($type[$NewId] == 'A') ? 'AAAA' : 'A' );
$numrows->execute();
.....
but i have not enought ime here to check and validate. Sorry :-(
@5050 I think it's better now. |
Add a check for A or AAAA record, they could have the same hostname and add an other naming for SOA (see commit message)