From: Mark Wells Date: Wed, 6 Jul 2016 18:48:45 +0000 (-0700) Subject: Merge branch 'master' of git.freeside.biz:/home/git/freeside X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=df43a12a1c219709f27297ad6b53f6662b56c10c;hp=2a0b5339081a439a8c5ec1f2b9cd28b63fd3fa49 Merge branch 'master' of git.freeside.biz:/home/git/freeside --- diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm index 7b4db9932..24ddf7920 100644 --- a/FS/FS/Mason.pm +++ b/FS/FS/Mason.pm @@ -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 diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 4ad963956..661625725 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -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'}); diff --git a/FS/FS/h_svc_acct.pm b/FS/FS/h_svc_acct.pm index 6e127a29e..6bc55ebc8 100644 --- a/FS/FS/h_svc_acct.pm +++ b/FS/FS/h_svc_acct.pm @@ -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(@_), diff --git a/FS/FS/h_svc_forward.pm b/FS/FS/h_svc_forward.pm index 7f6a5cca8..bc24fe911 100644 --- a/FS/FS/h_svc_forward.pm +++ b/FS/FS/h_svc_forward.pm @@ -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 }, diff --git a/FS/FS/h_svc_www.pm b/FS/FS/h_svc_www.pm index e719f1b47..d3f9811a4 100644 --- a/FS/FS/h_svc_www.pm +++ b/FS/FS/h_svc_www.pm @@ -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 }, diff --git a/htetc/freeside-base2.4.conf b/htetc/freeside-base2.4.conf index c6b1fd745..f0b44d7fa 100644 --- a/htetc/freeside-base2.4.conf +++ b/htetc/freeside-base2.4.conf @@ -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 diff --git a/htetc/freeside-base2.conf b/htetc/freeside-base2.conf index e981ef27b..309279dfa 100644 --- a/htetc/freeside-base2.conf +++ b/htetc/freeside-base2.conf @@ -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