From daac302e231e2e09b84e771c0413b0f2119c52e8 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 18 Mar 2002 09:10:12 +0000 Subject: [PATCH] new config value `defaultrecords', documentation, javascript config file editor --- FS/FS/Conf.pm | 22 +++++++--- FS/FS/svc_domain.pm | 85 +++++++----------------------------- README.1.4.0pre12 | 2 + httemplate/config/config-process.cgi | 6 +++ httemplate/config/config-view.cgi | 4 +- httemplate/config/config.cgi | 51 +++++++++++++++------- httemplate/docs/upgrade8.html | 3 +- 7 files changed, 81 insertions(+), 92 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 5dba387fe..18725ced2 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -437,28 +437,40 @@ httemplate/docs/config.html { 'key' => 'mxmachines', - 'section' => 'BIND', + 'section' => 'deprecated', 'description' => 'MX entries for new domains, weight and machine, one per line, with trailing `.\'', 'type' => 'textarea', }, { 'key' => 'nsmachines', - 'section' => 'BIND', + 'section' => 'deprecated', 'description' => 'NS nameservers for new domains, one per line, with trailing `.\'', 'type' => 'textarea', }, { - 'key' => 'arecords', + 'key' => 'defaultrecords', 'section' => 'BIND', - 'description' => 'A list of tab seperated A records to add automatically when creating a domain', + 'description' => 'DNS entries add automatically when creating a domain', + 'type' => 'editlist', + 'editlist_parts' => [ { type=>'text' }, + { type=>'immutable', value=>'IN' }, + { type=>'select', + select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS)} }, + { type=> 'text' }, ], + }, + + { + 'key' => 'arecords', + 'section' => 'deprecated', + 'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain', 'type' => 'textarea', }, { 'key' => 'cnamerecords', - 'section' => 'BIND', + 'section' => 'deprecated', 'description' => 'A list of tab seperated CNAME records to add automatically when creating a domain', 'type' => 'textarea', }, diff --git a/FS/FS/svc_domain.pm b/FS/FS/svc_domain.pm index 1e16ba87f..d01a403d1 100644 --- a/FS/FS/svc_domain.pm +++ b/FS/FS/svc_domain.pm @@ -2,8 +2,8 @@ package FS::svc_domain; use strict; use vars qw( @ISA $whois_hack $conf $smtpmachine - @mxmachines @nsmachines $soadefaultttl $soaemail $soaexpire $soamachine - $soarefresh $soaretry $qshellmachine $nossh_hack %arecords %cnamerecords + @defaultrecords $soadefaultttl $soaemail $soaexpire $soamachine + $soarefresh $soaretry $qshellmachine $nossh_hack ); use Carp; use Mail::Internet; @@ -29,10 +29,7 @@ $FS::UID::callback{'FS::domain'} = sub { $smtpmachine = $conf->config('smtpmachine'); - %arecords = map { split /\t/ } $conf->config('arecords'); - %cnamerecords = map { split /\t/ } $conf->config('cnamerecords'); - @mxmachines = $conf->config('mxmachines'); - @nsmachines = $conf->config('nsmachines'); + @defaultrecords = $conf->config('defaultrecords'); $soadefaultttl = $conf->config('soadefaultttl'); $soaemail = $conf->config('soaemail'); $soaexpire = $conf->config('soaexpire'); @@ -119,15 +116,9 @@ in the same package, it is automatically used. Otherwise an error is returned. If any I configuration file exists, an SOA record is added to the domain_record table (see ). -If any machines are defined in the I configuration file, NS -records are added to the domain_record table (see L). - -If any machines are defined in the I configuration file, MX -records are added to the domain_record table (see L). - -If the I configuration file exits, A records are added to the -domain_record table. The I file does the same thing for -CNAME records. +If any records are defined in the I configuration file, +appropriate records are added to the domain_record table (see +L). If a machine is defined in the I configuration value, the I configuration file exists, and the I field points @@ -200,63 +191,19 @@ sub insert { return "couldn't insert SOA record for new domain: $error"; } - foreach my $nsmachine ( @nsmachines ) { - my $ns = new FS::domain_record { - 'svcnum' => $self->svcnum, - 'reczone' => '@', - 'recaf' => 'IN', - 'rectype' => 'NS', - 'recdata' => $nsmachine, - }; - my $error = $ns->insert; - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return "couldn't insert NS record for new domain: $error"; - } - } - - foreach my $mxmachine ( @mxmachines ) { - my $mx = new FS::domain_record { - 'svcnum' => $self->svcnum, - 'reczone' => '@', - 'recaf' => 'IN', - 'rectype' => 'MX', - 'recdata' => $mxmachine, - }; - my $error = $mx->insert; - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return "couldn't insert MX record for new domain: $error"; - } - } - - foreach my $arecord ( keys %arecords ) { - my $arec = new FS::domain_record { - 'svcnum' => $self->svcnum, - 'reczone' => $arecord, - 'recaf' => 'IN', - 'rectype' => 'A', - 'recdata' => $arecords{$arecord}, - }; - my $error = $arec->insert; - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return "WARNING: couldn't insert A record for new domain: $error"; - } - } - - foreach my $cnamerecord ( keys %cnamerecords ) { - my $cnamerec = new FS::domain_record { + foreach my $record ( @defaultrecords ) { + my($zone,$af,$type,$data) = split(/\s+/,$record,4); + my $record = new FS::domain_record { 'svcnum' => $self->svcnum, - 'reczone' => $cnamerecord, - 'recaf' => 'IN', - 'rectype' => 'CNAME', - 'recdata' => $cnamerecords{$cnamerecord}, + 'reczone' => $zone, + 'recaf' => $af, + 'rectype' => $type, + 'recdata' => $data, }; - my $error = $cnamerec->insert; + my $error = $record->insert; if ( $error ) { $dbh->rollback if $oldAutoCommit; - return "WARNING: couldn't insert CNAME record for new domain: $error"; + return "couldn't insert record for new domain: $error"; } } @@ -460,7 +407,7 @@ sub submit_internic { =head1 VERSION -$Id: svc_domain.pm,v 1.25 2002-03-09 10:19:38 khoff Exp $ +$Id: svc_domain.pm,v 1.26 2002-03-18 09:10:12 ivan Exp $ =head1 BUGS diff --git a/README.1.4.0pre12 b/README.1.4.0pre12 index 824b7fd86..c801a2604 100644 --- a/README.1.4.0pre12 +++ b/README.1.4.0pre12 @@ -25,3 +25,5 @@ Arrange for freeside-expiration-alerter to be run daily, if desired. Restart Apache and freeside-queued +the mxmachines, nsmachines, arecords and cnamerecords configuration values have been deprecated. Use the defaultrecords configuration value instead. + diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index a296abfe4..38d9af0db 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -32,6 +32,12 @@ } else { $conf->delete($i->key); } + } elsif ( $type eq 'editlist' || $type eq 'selectmultiple' ) { + if ( scalar(@{[ $cgi->param($i->key. $n) ]}) ) { + $conf->set($i->key, join("\n", $cgi->param($i->key. $n) )); + } else { + $conf->delete($i->key); + } } else { } $n++; diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 917cc7316..d40c4dc10 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -8,6 +8,7 @@ shell mail radius apache BIND ), '', 'deprecated') { %> + <% foreach my $nav_section ( qw(required billing username password UI session shell mail radius apache BIND @@ -16,11 +17,10 @@ <% if ( $section eq $nav_section ) { %> [<%= ucfirst($nav_section || 'unclassified') %>] <% } else { %> - [<%= ucfirst($nav_section || 'unclassified') %>] + [<%= ucfirst($nav_section || 'unclassified') %>] <% } %> <% } %>
- <%= table("#cccccc", 2) %> diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi index 155dcfdbc..5013de0dc 100644 --- a/httemplate/config/config.cgi +++ b/httemplate/config/config.cgi @@ -2,25 +2,33 @@ <%= header('Edit Configuration', menubar( 'Main Menu' => $p ) ) %> <% my $conf = new FS::Conf; my @config_items = $conf->config_items; %> -
+ <% foreach my $section ( qw(required billing username password UI session shell mail radius apache BIND ), '', 'deprecated') { %> + <% foreach my $nav_section ( qw(required billing username password UI session shell mail radius apache BIND @@ -29,11 +37,10 @@ function SafeOnload() <% if ( $section eq $nav_section ) { %> [<%= ucfirst($nav_section || 'unclassified') %>] <% } else { %> - [<%= ucfirst($nav_section || 'unclassified') %>] + [<%= ucfirst($nav_section || 'unclassified') %>] <% } %> <% } %>
- <%= table("#cccccc", 2) %> @@ -65,6 +72,7 @@ function SafeOnload() <% if ( $conf->exists($i->key) && $conf->config($i->key) && ! grep { $conf->config($i->key) eq $_ } @{$i->select_enum}) { %>
diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 2640be419..25e766b1e 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -308,8 +308,9 @@ ALTER TABLE cust_refund DROP COLUMN crednum;
  • IMPORTANT: run bin/create-history-tables
  • IMPORTANT: After running bin/create-history-tables, run bin/dbdef-create again.
  • set the user_policy configuration value as appropriate for your site. +
  • the mxmachines, nsmachines, arecords and cnamerecords configuration values have been deprecated. Set the defaultrecords configuration value instead.
  • Create the `/usr/local/etc/freeside/cache.datasrc' directory - (ownded by the freeside user). + (owned by the freeside user).
  • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup.
  • Set appropriate invoice events for your site. At the very least, you'll want to set some invoice events "After 0 days": a BILL invoice event to print invoices, a CARD invoice event to batch or run cards real-time, and a COMP invoice event to "pay" complimentary customers. If you were using the -i option to freeside-bill it should be removed.
  • Use freeside-daily instead of freeside-bill. -- 2.11.0