Changeset 285
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r284 r285 1352 1352 local $dbh->{RaiseError} = 1; 1353 1353 1354 my $msg = ''; 1354 1355 my $failmsg = ''; 1356 my $zone = ($revrec eq 'n' ? domainName($dbh, $zoneid) : revName($dbh, $zoneid)); 1357 1358 # Set this up here since we may use if if $config{log_failures} is enabled 1359 my %loghash; 1360 $loghash{domain_id} = $zoneid if $revrec eq 'n'; 1361 $loghash{rdns_id} = $zoneid if $revrec eq 'y'; 1362 $loghash{group_id} = parentID($dbh, 1363 (id => $zoneid, type => ($revrec eq 'n' ? 'domain' : 'revzone'), revrec => $revrec) ); 1355 1364 1356 1365 # Wrap all the SQL in a transaction … … 1383 1392 } 1384 1393 1394 $msg = "Deleted ".($revrec eq 'n' ? 'domain' : 'reverse zone')." $zone"; 1395 $loghash{entry} = $msg; 1396 _log($dbh, %loghash); 1397 1385 1398 # once we get here, we should have suceeded. 1386 1399 $dbh->commit; … … 1388 1401 1389 1402 if ($@) { 1390 my$msg = $@;1403 $msg = $@; 1391 1404 eval { $dbh->rollback; }; 1392 return ('FAIL',"$failmsg: $msg"); 1405 $loghash{entry} = "Delete $zone: $failmsg: $msg"; 1406 _log($dbh, %loghash) if $config{log_failures}; 1407 $dbh->commit; # since we enabled transactions earlier 1408 return ('FAIL',"Delete $zone: $failmsg: $msg"); 1393 1409 } else { 1394 return ('OK', 'OK');1410 return ('OK',$msg); 1395 1411 } 1396 1412 -
trunk/dns.cgi
r284 r285 415 415 } elsif ($webvar{del} eq 'ok') { 416 416 my $pargroup = parentID($dbh, (id => $webvar{id}, type => 'domain', revrec => $webvar{revrec})); 417 my $dom = domainName($dbh, $webvar{id});418 417 my ($code,$msg) = delZone($dbh, $webvar{id}, $webvar{revrec}); 419 418 if ($code eq 'OK') { 420 logaction($webvar{id}, $session->param("username"), $pargroup, "Deleted domain $dom"); 421 changepage(page => "domlist", resultmsg => "Deleted domain $dom"); 419 changepage(page => "domlist", resultmsg => $msg); 422 420 } else { 423 logaction($webvar{id}, $session->param("username"), $pargroup, "Failed to delete domain $dom ($msg)") 424 if $config{log_failures}; 425 changepage(page => "domlist", errmsg => "Error deleting domain $dom: $msg"); 421 changepage(page => "domlist", errmsg => $msg); 426 422 } 427 423 … … 528 524 my ($code,$msg) = delZone($dbh, $webvar{id}, 'y'); 529 525 if ($code eq 'OK') { 530 ##fixme: logaction needs to take "domid OR revid" and some way to know which it is 531 logaction($webvar{id}, $session->param("username"), $pargroup, "Deleted reverse zone $zone"); 532 changepage(page => "revzones", resultmsg => "Deleted reverse zone $zone"); 526 changepage(page => "revzones", resultmsg => $msg); 533 527 } else { 534 logaction($webvar{id}, $session->param("username"), $pargroup, "Failed to delete domain $zone ($msg)") 535 if $config{log_failures}; 536 #push @debugbits, "got back $code, $msg\n"; 537 changepage(page => "revzones", errmsg => "Error deleting reverse zone $zone: $msg"); 528 changepage(page => "revzones", errmsg => $msg); 538 529 } 539 530
Note:
See TracChangeset
for help on using the changeset viewer.