Changeset 495 for trunk


Ignore:
Timestamp:
05/03/13 15:36:40 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Rename getDomRecs to getRecList since it's used for group default
records, domain records, and reverse zone records.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r490 r495  
    4949        &addLoc &updateLoc &delLoc &getLoc
    5050        &getLocCount &getLocList &getLocDropdown
    51         &getSOA &updateSOA &getRecLine &getDomRecs &getRecCount
     51        &getSOA &updateSOA &getRecLine &getRecList &getRecCount
    5252        &addRec &updateRec &delRec
    5353        &getLogCount &getLogEntries
     
    7777                &addLoc &updateLoc &delLoc &getLoc
    7878                &getLocCount &getLocList &getLocDropdown
    79                 &getSOA &updateSOA &getRecLine &getDomRecs &getRecCount
     79                &getSOA &updateSOA &getRecLine &getRecList &getRecCount
    8080                &addRec &updateRec &delRec
    8181                &getLogCount &getLogEntries
     
    238238  $self->{dbh}->disconnect;
    239239}
     240
     241sub errstr { $DNSDB::errstr; }
    240242
    241243##
     
    34653467
    34663468##fixme: should use above (getRecLine()) to get lines for below?
    3467 ## DNSDB::getDomRecs()
    3468 # Return records for a domain
    3469 # Takes a database handle, default/live flag, group/domain ID, start,
     3469## DNSDB::getRecList()
     3470# Return records for a group or zone
     3471# Takes a default/live flag, group or zone ID, start,
    34703472# number of records, sort field, and sort order
    34713473# Returns a reference to an array of hashes
    3472 sub getDomRecs {
     3474sub getRecList {
    34733475  $errstr = '';
    34743476  my $self = shift;
     
    35183520
    35193521  my $ret = $dbh->selectall_arrayref($sql, { Slice => {} }, (@bindvars) );
     3522  $errstr = "Error retrieving records: ".$dbh->errstr if !$ret;
    35203523  return $ret;
    3521 } # end getDomRecs()
     3524} # end getRecList()
    35223525
    35233526
  • trunk/dns-rpc.cgi

    r490 r495  
    5252        'dnsdb.getSOA'          => \&getSOA,
    5353        'dnsdb.getRecLine'      => \&getRecLine,
    54         'dnsdb.getDomRecs'      => \&getDomRecs,
     54        'dnsdb.getRecList'      => \&getRecList,
    5555        'dnsdb.getRecCount'     => \&getRecCount,
    5656        'dnsdb.addRec'          => \&addRec,
     
    341341}
    342342
    343 sub getDomRecs {
     343sub getRecList {
    344344  my %args = @_;
    345345
     
    353353  $args{direction} = 'ASC' if !$args{direction};
    354354
    355   my $ret = $dnsdb->getDomRecs(defrec => $args{defrec}, revrec => $args{revrec}, id => $args{id},
     355  my $ret = $dnsdb->getRecList(defrec => $args{defrec}, revrec => $args{revrec}, id => $args{id},
    356356        offset => $args{offset}, sortby => $args{sortby}, sortorder => $args{sortorder},
    357357        filter => $args{filter});
     
    443443      # We need to strip the CIDR mask on IPv4 /32 assignments, or we just add a new record all the time.
    444444      my $filt = ($cidr->{isv6} || $cidr->masklen != 32 ? "$cidr" : $cidr->addr);
    445       my $reclist = $dnsdb->getDomRecs(defrec => 'n', revrec => 'y',
     445      my $reclist = $dnsdb->getRecList(defrec => 'n', revrec => 'y',
    446446        id => $zonelist->[0]->{rdns_id}, filter => $filt);
    447447      if (scalar(@$reclist) == 0) {
     
    477477    # that spans multiple reverse zones (eg, /23 CIDR -> 2 /24 rzones)
    478478    foreach my $zdata (@$zonelist) {
    479       my $reclist = $dnsdb->getDomRecs(defrec => 'n', revrec => 'y',
     479      my $reclist = $dnsdb->getRecList(defrec => 'n', revrec => 'y',
    480480        id => $zdata->{rdns_id}, filter => $zdata->{revnet});
    481481      if (scalar(@$reclist) == 0) {
     
    527527      if ($args{delsubs}) {
    528528        # Delete ALL EVARYTHING!!one11!! in $args{cidr}
    529         my $reclist = $dnsdb->getDomRecs(defrec => 'n', revrec => 'y', id => $zonelist->[0]->{rdns_id});
     529        my $reclist = $dnsdb->getRecList(defrec => 'n', revrec => 'y', id => $zonelist->[0]->{rdns_id});
    530530        foreach my $rec (@$reclist) {
    531531          my $reccidr = new NetAddr::IP $rec->{val};
     
    554554        # We need to strip the CIDR mask on IPv4 /32 assignments, or we can't find single-IP records
    555555        my $filt = ($cidr->{isv6} || $cidr->masklen != 32 ? "$cidr" : $cidr->addr);
    556         my $reclist = $dnsdb->getDomRecs(defrec => 'n', revrec => 'y',
     556        my $reclist = $dnsdb->getRecList(defrec => 'n', revrec => 'y',
    557557          id => $zonelist->[0]->{rdns_id}, filter => $filt, sortby => 'val', sortorder => 'DESC');
    558558        foreach my $rec (@$reclist) {
     
    582582    # that spans multiple reverse zones (eg, /23 CIDR -> 2 /24 rzones)
    583583    foreach my $zdata (@$zonelist) {
    584       my $reclist = $dnsdb->getDomRecs(defrec => 'n', revrec => 'y', id => $zdata->{rdns_id});
     584      my $reclist = $dnsdb->getRecList(defrec => 'n', revrec => 'y', id => $zdata->{rdns_id});
    585585      if (scalar(@$reclist) == 0) {
    586586# nothing to do?  or do we (re)add a record based on the parent?
  • trunk/dns.cgi

    r493 r495  
    19611961  $page->param(ttl      => $soa->{ttl});
    19621962
    1963   my $foo2 = $dnsdb->getDomRecs(defrec => $def, revrec => $rev, id => $id, offset => $webvar{offset},
     1963  my $foo2 = $dnsdb->getRecList(defrec => $def, revrec => $rev, id => $id, offset => $webvar{offset},
    19641964        sortby => $sortby, sortorder => $sortorder, filter => $filter);
    19651965
  • trunk/textrecs.cgi

    r494 r495  
    6363
    6464##fixme:  do we support both HTML-plain and true plaintext?  could be done, with another $webvar{}
    65 # Don't die on bad parameters.  Saves munging the return from getDomRecs.
     65# Don't die on bad parameters.  Saves munging the return from getRecList.
    6666#my $page = HTML::Template->new(filename => "$templatedir/textrecs.tmpl",
    6767#       loop_context_vars => 1, global_vars => 1, die_on_bad_params => 0);
     
    7474print qq(Press the "Back" button to return to the standard record list.\n\n);
    7575
    76 my $reclist = $dnsdb->getDomRecs(defrec => $webvar{defrec}, revrec => $webvar{revrec}, id => $webvar{id},
     76my $reclist = $dnsdb->getRecList(defrec => $webvar{defrec}, revrec => $webvar{revrec}, id => $webvar{id},
    7777        sortby => ($webvar{revrec} eq 'n' ? 'type,host' : 'type,val'), sortorder => 'ASC');
    7878foreach my $rec (@$reclist) {
Note: See TracChangeset for help on using the changeset viewer.