Changeset 283 for trunk/DNSDB.pm
- Timestamp:
- 03/22/12 16:12:32 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r282 r283 80 80 our $group = 1; 81 81 our $errstr = ''; 82 our $resultstr = ''; 82 83 83 84 # Halfway sane defaults for SOA, TTL, etc. … … 2847 2848 return undef if $id !~ /^\d+$/; 2848 2849 2849 # ooo, fun! let's see what we were passed for status 2850 # Allow transactions, and raise an exception on errors so we can catch it later. 2851 # Use local to make sure these get "reset" properly on exiting this block 2852 local $dbh->{AutoCommit} = 0; 2853 local $dbh->{RaiseError} = 1; 2854 2850 2855 if ($newstatus ne 'mu') { 2851 $newstatus = 0 if $newstatus eq 'domoff'; 2852 $newstatus = 1 if $newstatus eq 'domon'; 2853 $dbh->do("UPDATE ".($revrec eq 'n' ? 'domains' : 'revzones')." SET status=? WHERE ". 2856 # ooo, fun! let's see what we were passed for status 2857 eval { 2858 $newstatus = 0 if $newstatus eq 'domoff'; 2859 $newstatus = 1 if $newstatus eq 'domon'; 2860 $dbh->do("UPDATE ".($revrec eq 'n' ? 'domains' : 'revzones')." SET status=? WHERE ". 2854 2861 ($revrec eq 'n' ? 'domain_id' : 'rdns_id')."=?", undef, ($newstatus,$id) ); 2862 2863 ##fixme switch to more consise "Enabled <domain"/"Disabled <domain>" as with users? 2864 $resultstr = "Changed ".($revrec eq 'n' ? domainName($dbh, $id) : revName($dbh, $id)). 2865 " state to ".($newstatus ? 'active' : 'inactive'); 2866 2867 my %loghash; 2868 $loghash{domain_id} = $id if $revrec eq 'n'; 2869 $loghash{rdns_id} = $id if $revrec eq 'y'; 2870 $loghash{group_id} = parentID($dbh, 2871 (id => $id, type => ($revrec eq 'n' ? 'domain' : 'revzone'), revrec => $revrec) ); 2872 $loghash{entry} = $resultstr; 2873 _log($dbh, %loghash); 2874 2875 $dbh->commit; 2876 }; 2877 if ($@) { 2878 my $msg = $@; 2879 eval { $dbh->rollback; }; 2880 $resultstr = ''; 2881 $errstr = $msg; 2882 return; 2883 } 2855 2884 } 2856 2885 … … 3262 3291 3263 3292 ## DNSDB::mailNotify() 3264 # Sends notification mail to recipients regarding a n IPDB operation3293 # Sends notification mail to recipients regarding a DNSDB operation 3265 3294 sub mailNotify { 3266 3295 my $dbh = shift;
Note:
See TracChangeset
for help on using the changeset viewer.