Changeset 5 for trunk


Ignore:
Timestamp:
09/01/09 17:07:57 (15 years ago)
Author:
Kris Deugau
Message:

/trunk

checkpoint
Delete domain mostly complete - need to fix up "redirection" after completion

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r4 r5  
    209209sub delDomain {
    210210  my $dbh = shift;
    211   my $domain = shift;
     211  my $domid = shift;
    212212
    213213  # Allow transactions, and raise an exception on errors so we can catch it later.
     
    218218  # Wrap all the SQL in a transaction
    219219  eval {
    220     # brute force.
    221     my $sth = $dbh->prepare("select domain_id from domains where domain=?");
    222     $sth->execute($domain);
    223     die "Domain not found, can't delete\n" if $sth->rows < 1;
    224     my ($id) = $sth->fetchrow_array;
    225 
    226     $sth = $dbh->prepare("delete from records where domain_id=$id");
    227     $sth->execute;
    228     $sth = $dbh->prepare("delete from domains where domain=?");
    229     $sth->execute($domain);
     220    my $sth = $dbh->prepare("delete from records where domain_id=?");
     221    $sth->execute($domid);
     222    $sth = $dbh->prepare("delete from domains where domain_id=?");
     223    $sth->execute($domid);
    230224
    231225    # once we get here, we should have suceeded.
  • trunk/dns.cgi

    r4 r5  
    300300  }
    301301
     302} elsif ($webvar{page} eq 'deldom') {
     303
     304  $page->param(id => $webvar{id});
     305  # first pass = confirm y/n (sorta)
     306  if (!defined($webvar{del})) {
     307    $page->param(del_getconf => 1);
     308    $page->param(domain => domainName($dbh,$webvar{id}));
     309# print some neato things?
     310  } elsif ($webvar{del} eq 'ok') {
     311    my ($code,$msg) = delDomain($dbh, $webvar{id});
     312    if ($code ne 'OK') {
     313# need to find failure mode
     314      $page->param(del_failed => 1);
     315      $page->param(errmsg => $msg);
     316    }
     317  } else {
     318    # cancelled.  whee!
     319    $page->param(del_failed => 0);
     320# more params?
     321  }
     322
    302323} elsif ($webvar{page} eq 'editsoa') {
    303324
Note: See TracChangeset for help on using the changeset viewer.