- Timestamp:
- 10/20/09 14:47:36 (15 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r22 r23 226 226 local $dbh->{RaiseError} = 1; 227 227 228 my $failmsg = ''; 229 228 230 # Wrap all the SQL in a transaction 229 231 eval { 230 232 my $sth = $dbh->prepare("delete from records where domain_id=?"); 233 $failmsg = "Failure removing domain records"; 231 234 $sth->execute($domid); 232 235 $sth = $dbh->prepare("delete from domains where domain_id=?"); 236 $failmsg = "Failure removing domain"; 233 237 $sth->execute($domid); 234 238 235 #die "full of fail\n";236 239 # once we get here, we should have suceeded. 237 #$dbh->commit;240 $dbh->commit; 238 241 }; # end eval 239 242 … … 241 244 my $msg = $@; 242 245 eval { $dbh->rollback; }; 243 return ('FAIL', $msg);246 return ('FAIL',"$failmsg: $msg"); 244 247 } else { 245 248 return ('OK','OK'); … … 340 343 341 344 ##fixme: locate "knowable" error conditions and deal with them before the eval 345 # ... or inside, whatever. 342 346 # -> domains still exist in group 343 347 # -> ... 348 my $failmsg = ''; 344 349 345 350 # Wrap all the SQL in a transaction 346 351 eval { 347 my $sth = $dbh->prepare("delete from default_records where group_id=?"); 352 my $sth = $dbh->prepare("SELECT count(*) FROM domains WHERE group_id=?"); 353 $sth->execute($groupid); 354 my ($domcnt) = $sth->fetchrow_array; 355 $failmsg = "Can't remove group ".groupName($dbh,$groupid); 356 die "$domcnt domains still in group\n" if $domcnt; 357 358 $sth = $dbh->prepare("delete from default_records where group_id=?"); 359 $failmsg = "Failed to delete default records for ".groupName($dbh,$groupid); 348 360 $sth->execute($groupid); 349 361 $sth = $dbh->prepare("delete from groups where group_id=?"); 362 $failmsg = "Failed to remove group ".groupName($dbh,$groupid); 350 363 $sth->execute($groupid); 351 364 352 die "epic group fail FTW!\n";353 365 # once we get here, we should have suceeded. 354 366 $dbh->commit; … … 358 370 my $msg = $@; 359 371 eval { $dbh->rollback; }; 360 return ('FAIL', $msg);372 return ('FAIL',"$failmsg: $msg"); 361 373 } else { 362 374 return ('OK','OK'); … … 447 459 $sql .= " records where domain_id=$id and type=$reverse_typemap{SOA}"; 448 460 } 449 #print "getSOA DEBUG: $sql<br>\n";450 461 my $sth = $dbh->prepare($sql); 451 462 $sth->execute; … … 649 660 $sth->execute($id); 650 661 651 return ('FAIL', $sth->errstr) if $sth->err;662 return ('FAIL',"Couldn't remove record: ".$sth->errstr) if $sth->err; 652 663 653 664 return ('OK','OK'); -
trunk/dns.cgi
r22 r23 392 392 if (!defined($webvar{del})) { 393 393 $page->param(del_getconf => 1); 394 $page->param(groupname => groupName($dbh,$webvar{id}));394 # $page->param(groupname => groupName($dbh,$webvar{id})); 395 395 # print some neato things? 396 396 … … 400 400 } elsif ($webvar{del} eq 'ok') { 401 401 my ($code,$msg) = delGroup($dbh, $webvar{id}); 402 push @debugbits, groupName($dbh, $webvar{id}); 402 403 if ($code ne 'OK') { 403 404 # need to find failure mode … … 414 415 changepage(page => "grpman"); 415 416 } 416 417 $page->param(delgroupname => groupName($dbh, $webvar{id})); 417 418 } 418 419 … … 539 540 $rec->{sid} = $webvar{sid}; 540 541 $rec->{id} = $id; 542 $rec->{distance} = 'n/a' unless ($rec->{type} eq 'MX' || $rec->{type} eq 'SRV'); 543 $rec->{weight} = 'n/a' unless ($rec->{type} eq 'SRV'); 544 $rec->{port} = 'n/a' unless ($rec->{type} eq 'SRV'); 541 545 $row++; 542 546 } 543 547 $page->param(reclist => $foo2); 544 548 } 549 545 550 546 551 # fill in record type list on add/update/edit record template -
trunk/templates/delgrp.tmpl
r22 r23 4 4 5 5 <td align="center"> 6 <h3>Are you really sure you want to delete group <TMPL_VAR NAME= groupname>?</h3>6 <h3>Are you really sure you want to delete group <TMPL_VAR NAME=delgroupname>?</h3> 7 7 <a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=delgrp&del=cancel&id=<TMPL_VAR NAME=id>">cancel</a> | 8 8 <a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=delgrp&del=ok&id=<TMPL_VAR NAME=id>">confirm</a> … … 11 11 <TMPL_ELSE> 12 12 <!-- <TMPL_IF del_failed> 13 <div class='errmsg'>Error deleting group <TMPL_VAR NAME= groupname>: <TMPL_VAR NAME=errmsg></div>13 <div class='errmsg'>Error deleting group <TMPL_VAR NAME=delgroupname>: <TMPL_VAR NAME=errmsg></div> 14 14 </TMPL_IF> --> 15 15 <TMPL_INCLUDE NAME="grpman.tmpl"> -
trunk/templates/grpman.tmpl
r22 r23 6 6 7 7 <TMPL_IF del_failed> 8 <div class='errmsg'>Error deleting group <TMPL_VAR NAME= groupname>: <TMPL_VAR NAME=errmsg></div>8 <div class='errmsg'>Error deleting group <TMPL_VAR NAME=delgroupname>: <TMPL_VAR NAME=errmsg></div> 9 9 </TMPL_IF> 10 10 … … 39 39 <TMPL_LOOP name=grouptable> 40 40 <tr class="row<TMPL_VAR name=bg>"> 41 <td><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=grpman& id=<TMPL_VAR NAME=groupid>"><TMPL_VAR NAME=groupname></a></td>41 <td><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&page=grpman&action=chgroup&group=<TMPL_VAR NAME=groupid>"><TMPL_VAR NAME=groupname></a></td> 42 42 <td width="5%" nowrap><TMPL_VAR name=pgroup></td> 43 43 <td width="5%" nowrap><TMPL_VAR name=nusers></td>
Note:
See TracChangeset
for help on using the changeset viewer.