Changeset 773


Ignore:
Timestamp:
07/30/19 16:53:04 (5 years ago)
Author:
Kris Deugau
Message:

/trunk

Start creating SOA serial numbers instead of letting tinydns manage them,
1 of mumble. See #24, sort of.

Tweak the serial on record changes:

  • updateSOA()
  • addRec()
  • updateRec()
  • downconvert()
  • delRec()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r772 r773  
    42404240        " retry $soa{retry}, expire $soa{expire}, minTTL $soa{minttl}, TTL $soa{ttl})";
    42414241    }
     4242    if ($revrec eq 'y') {
     4243      $dbh->do("UPDATE revzones SET changed = 'y',zserial = ? WHERE rdns_id = ?", undef, (scalar(time), $soa{id}) );
     4244    } else {
     4245      $dbh->do("UPDATE domains SET changed = 'y',zserial = ? WHERE domain_id = ?", undef, (scalar(time), $soa{id}) );
     4246    }
    42424247    $logdata{entry} = $msg;
    42434248    $self->_log(%logdata);
     
    45884593    $dbh->do("INSERT INTO "._rectable($defrec, $revrec)." ($fields) VALUES ($vallen)",
    45894594        undef, @vallist);
     4595    if ($revrec eq 'y') {
     4596      $dbh->do("UPDATE revzones SET changed = 'y',zserial = ? WHERE rdns_id = ?", undef, (scalar(time), $domid) );
     4597    } else {
     4598      $dbh->do("UPDATE domains SET changed = 'y',zserial = ? WHERE domain_id = ?", undef, (scalar(time), $domid) );
     4599    }
    45904600    $self->_log(%logdata);
    45914601    $dbh->commit;
     
    47884798  eval {
    47894799    $dbh->do("UPDATE "._rectable($defrec,$revrec)." SET $fields WHERE record_id=?", undef, (@vallist, $id) );
     4800    if ($revrec eq 'y') {
     4801      $dbh->do("UPDATE revzones SET changed = 'y',zserial = ? WHERE rdns_id = ?", undef, (scalar(time), $domid) );
     4802    } else {
     4803      $dbh->do("UPDATE domains SET changed = 'y',zserial = ? WHERE domain_id = ?", undef, (scalar(time), $domid) );
     4804    }
    47904805    $self->_log(%logdata);
    47914806    $dbh->commit;
     
    48534868  eval {
    48544869    $dbh->do("UPDATE records SET $delpar = ?, type = ? WHERE record_id = ?", undef, @sqlargs);
     4870    # both forward and reverse zones affected, more or less by definition
     4871    $dbh->do("UPDATE revzones SET changed = 'y',zserial = ? WHERE rdns_id = ?", undef, (scalar(time), $rec->{rdns_id}) );
     4872    $dbh->do("UPDATE domains SET changed = 'y',zserial = ? WHERE domain_id = ?", undef, (scalar(time), $rec->{domain_id}) );
    48554873    $self->_log(domain_id => $rec->{domain_id}, rdns_id => $rec->{rdns_id},
    48564874        group_id => $self->parentID(id => $rec->{rdns_id}, type => 'revzone', revrec => 'y'),
     
    49034921
    49044922  eval {
    4905     my $sth = $dbh->do("DELETE FROM "._rectable($defrec,$revrec)." WHERE record_id=?", undef, ($id));
     4923    $dbh->do("DELETE FROM "._rectable($defrec,$revrec)." WHERE record_id=?", undef, ($id));
     4924    if ($revrec eq 'y') {
     4925      $dbh->do("UPDATE revzones SET changed = 'y',zserial = ? WHERE rdns_id = ?", undef, (scalar(time), $oldrec->{domain_id}) );
     4926    } else {
     4927      $dbh->do("UPDATE domains SET changed = 'y',zserial = ? WHERE domain_id = ?", undef, (scalar(time), $oldrec->{rdns_id}) );
     4928    }
    49064929    $self->_log(%logdata);
    49074930    $dbh->commit;
Note: See TracChangeset for help on using the changeset viewer.