Merge branch 'master' of git.freeside.biz:/home/git/freeside
authorMark Wells <mark@freeside.biz>
Wed, 6 Jul 2016 18:48:45 +0000 (11:48 -0700)
committerMark Wells <mark@freeside.biz>
Wed, 6 Jul 2016 18:48:45 +0000 (11:48 -0700)
FS/FS/Mason.pm
FS/FS/cust_pkg.pm
FS/FS/h_svc_acct.pm
FS/FS/h_svc_forward.pm
FS/FS/h_svc_www.pm
htetc/freeside-base2.4.conf
htetc/freeside-base2.conf

index 7b4db99..24ddf79 100644 (file)
@@ -573,7 +573,7 @@ if ( -e $addl_handler_use_file ) {
 
 } # end package HTML::Mason::Commands;
 
-=head1 SUBROUTINE
+=head1 SUBROUTINES
 
 =over 4
 
@@ -669,6 +669,35 @@ sub mason_interps {
 
 }
 
+=item child_init
+
+Per-process Apache child initialization code.
+
+Calls srand() to re-seed Perl's PRNG so that multiple children do not generate
+the same "random" numbers.
+
+Works around a Net::SSLeay connection error by creating and deleting an SSL
+context, so subsequent connections do not error out with a CTX_new (900 NET OR
+SSL ERROR).
+
+=cut
+
+sub child_init {
+  #my ($pool, $server) = @_; #the child process pool (APR::Pool) and the server object (Apache2::ServerRec).
+
+  srand();
+
+  #{
+    use Net::SSLeay;
+    package Net::SSLeay;
+    initialize();
+    my $bad_ctx = new_x_ctx();
+    while ( ERR_get_error() ) {}; #print_errs('CTX_new');
+    CTX_free($bad_ctx);
+  #}
+
+}
+
 =back
 
 =head1 BUGS
index 4ad9639..6616257 100644 (file)
@@ -1265,7 +1265,13 @@ sub uncancel_svc_summary {
           'uncancel_svcnum' => $svc_x->get('_h_svc_x')->svcnum,
         };
         $svc_x->pkgnum($self->pkgnum); # provisioning services on a canceled package, will be rolled back
-        if ($opt{'no_test_reprovision'} or $svc_x->insert) {
+        my $insert_error;
+        unless ($opt{'no_test_reprovision'}) {
+          # avoid possibly fatal errors from missing linked records
+          eval { $insert_error = $svc_x->insert };
+          $insert_error ||= $@;
+        }
+        if ($opt{'no_test_reprovision'} or $insert_error) {
           # avoid possibly fatal errors from missing linked records
           eval { $out->{'label'} = $svc_x->label };
           eval { $out->{'label'} = $svc_x->get('_h_svc_x')->label } unless defined($out->{'label'});
index 6e127a2..6bc55eb 100644 (file)
@@ -29,6 +29,7 @@ FS::h_svc_acct - Historical account objects
 sub svc_domain {
   my $self = shift;
   local($FS::Record::qsearch_qualify_columns) = 0;
+  $_[0] ||= $self->history_date;
   qsearchs( 'h_svc_domain',
             { 'svcnum' => $self->domsvc },
             FS::h_svc_domain->sql_h_searchs(@_),
index 7f6a5cc..bc24fe9 100644 (file)
@@ -35,6 +35,7 @@ sub srcsvc_acct {
 
   local($FS::Record::qsearch_qualify_columns) = 0;
 
+  $_[0] ||= $self->history_date;
   my $h_svc_acct = qsearchs(
     'h_svc_acct',
     { 'svcnum' => $self->srcsvc },
@@ -58,6 +59,7 @@ sub dstsvc_acct {
 
   local($FS::Record::qsearch_qualify_columns) = 0;
 
+  $_[0] ||= $self->history_date;
   my $h_svc_acct = qsearchs(
     'h_svc_acct',
     { 'svcnum' => $self->dstsvc },
index e719f1b..d3f9811 100644 (file)
@@ -34,6 +34,7 @@ sub domain_record {
   carp 'Called FS::h_svc_www->domain_record on svcnum ' . $self->svcnum if $DEBUG;
 
   local($FS::Record::qsearch_qualify_columns) = 0;
+  $_[0] ||= $self->history_date;
   my $domain_record = qsearchs(
     'h_domain_record',
     { 'recnum' => $self->recnum },
index c6b1fd7..f0b44d7 100644 (file)
@@ -7,12 +7,11 @@ PerlModule HTML::Mason
 PerlSetVar MasonArgsMethod CGI
 PerlModule HTML::Mason::ApacheHandler
 
-PerlChildInitHandler "sub { srand }"
-
 PerlRequire "%%%MASON_HANDLER%%%"
 
+PerlChildInitHandler FS::Mason::child_init
+
 #Locale::SubCountry
-#
 AddDefaultCharset UTF-8
 
 PerlModule FS::AuthCookieHandler24
index e981ef2..309279d 100644 (file)
@@ -6,12 +6,11 @@ PerlModule HTML::Mason
 PerlSetVar MasonArgsMethod CGI
 PerlModule HTML::Mason::ApacheHandler
 
-PerlChildInitHandler "sub { srand }"
-
 PerlRequire "%%%MASON_HANDLER%%%"
 
+PerlChildInitHandler FS::Mason::child_init
+
 #Locale::SubCountry
-#
 AddDefaultCharset UTF-8
 
 PerlModule FS::AuthCookieHandler