Changeset 781
- Timestamp:
- 08/13/19 17:46:19 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/DNSDB.pm ¶
r780 r781 494 494 # } elsif ($self->{log_channel} eq 'syslog') { 495 495 # } 496 } # end _log 496 } # end _log() 497 498 ## DNSDB::_updateserial() 499 # Update the serial number on a forward and/or reverse zone, and flag it as changed 500 # Takes a logdata hash 501 sub _updateserial { 502 my $self = shift; 503 my $dbh = $self->{dbh}; 504 505 my %args = @_; 506 507 ##fixme: add alternate serial schemes here 508 509 if ($args{rdns_id}) { 510 $dbh->do("UPDATE revzones SET changed = 'y',zserial = ? WHERE rdns_id = ?", undef, (scalar(time), $args{rdns_id}) ); 511 } 512 if ($args{domain_id}) { 513 $dbh->do("UPDATE domains SET changed = 'y',zserial = ? WHERE domain_id = ?", undef, (scalar(time), $args{domain_id}) ); 514 } 515 } # end _updateserial() 497 516 498 517 … … 4254 4273 " retry $soa{retry}, expire $soa{expire}, minTTL $soa{minttl}, TTL $soa{ttl})"; 4255 4274 } 4256 if ($revrec eq 'y') { 4257 $dbh->do("UPDATE revzones SET changed = 'y',zserial = ? WHERE rdns_id = ?", undef, (scalar(time), $soa{id}) ); 4258 } else { 4259 $dbh->do("UPDATE domains SET changed = 'y',zserial = ? WHERE domain_id = ?", undef, (scalar(time), $soa{id}) ); 4260 } 4275 _updateserial(%logdata); 4261 4276 $logdata{entry} = $msg; 4262 4277 $self->_log(%logdata); … … 4607 4622 $dbh->do("INSERT INTO "._rectable($defrec, $revrec)." ($fields) VALUES ($vallen)", 4608 4623 undef, @vallist); 4609 if ($revrec eq 'y') { 4610 $dbh->do("UPDATE revzones SET changed = 'y',zserial = ? WHERE rdns_id = ?", undef, (scalar(time), $domid) ); 4611 } else { 4612 $dbh->do("UPDATE domains SET changed = 'y',zserial = ? WHERE domain_id = ?", undef, (scalar(time), $domid) ); 4613 } 4624 _updateserial(%logdata); 4614 4625 $self->_log(%logdata); 4615 4626 $dbh->commit; … … 4812 4823 eval { 4813 4824 $dbh->do("UPDATE "._rectable($defrec,$revrec)." SET $fields WHERE record_id=?", undef, (@vallist, $id) ); 4814 if ($revrec eq 'y') { 4815 $dbh->do("UPDATE revzones SET changed = 'y',zserial = ? WHERE rdns_id = ?", undef, (scalar(time), $domid) ); 4816 } else { 4817 $dbh->do("UPDATE domains SET changed = 'y',zserial = ? WHERE domain_id = ?", undef, (scalar(time), $domid) ); 4818 } 4825 _updateserial(%logdata); 4819 4826 $self->_log(%logdata); 4820 4827 $dbh->commit; … … 4882 4889 eval { 4883 4890 $dbh->do("UPDATE records SET $delpar = ?, type = ? WHERE record_id = ?", undef, @sqlargs); 4884 # both forward and reverse zones affected, more or less by definition 4885 $dbh->do("UPDATE revzones SET changed = 'y',zserial = ? WHERE rdns_id = ?", undef, (scalar(time), $rec->{rdns_id}) ); 4886 $dbh->do("UPDATE domains SET changed = 'y',zserial = ? WHERE domain_id = ?", undef, (scalar(time), $rec->{domain_id}) ); 4891 # we have no %logdata in this sub 4892 _updateserial(domain_id => $rec->{domain_id}, rdns_id => $rec->{rdns_id}); 4887 4893 $self->_log(domain_id => $rec->{domain_id}, rdns_id => $rec->{rdns_id}, 4888 4894 group_id => $self->parentID(id => $rec->{rdns_id}, type => 'revzone', revrec => 'y'), … … 4950 4956 $logdata{entry} = "Error deleting ".($defrec eq 'y' ? 'default record' : 'record'). 4951 4957 " '$oldrec->{host} $typemap{$oldrec->{type}} $oldrec->{val}', TTL $oldrec->{ttl} ($msg)"; 4958 _updateserial(%logdata); 4952 4959 $self->_log(%logdata); 4953 4960 $dbh->commit; … … 5520 5527 # status - active/inactive state flag (defaults to active) 5521 5528 # rwsoa - overwrite-SOA flag (defaults to off) 5529 # keepserial - keep the upstream serial number even if we overwrite the rest of the SOA 5522 5530 # rwns - overwrite-NS flag (defaults to off, doesn't affect subdomain NS records) 5523 5531 # merge - flag to automerge A or AAAA records with matching PTR records
Note:
See TracChangeset
for help on using the changeset viewer.