|
From: Chris W. <la...@us...> - 2001-11-15 05:12:36
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv7598
Modified Files:
ApacheStartup.pm
Log Message:
modified how we do the childinit -- we no longer rely on ANY
perlsetvar items; instead we set in startup.pl some package info in
the OpenInteract package
Index: ApacheStartup.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/ApacheStartup.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** ApacheStartup.pm 2001/11/09 14:18:58 1.19
--- ApacheStartup.pm 2001/11/15 05:12:33 1.20
***************
*** 11,16 ****
use constant DEBUG => 0;
! $OpenInteract::ApacheStartup::VERSION = '1.07';
! $OpenInteract::ApacheStartup::Revision = substr(q$Revision$, 10);
# Create a handler to put the X-Forwarded-For header into the IP
--- 11,15 ----
use constant DEBUG => 0;
! $OpenInteract::ApacheStartup::VERSION = substr(q$Revision$, 10);
# Create a handler to put the X-Forwarded-For header into the IP
***************
*** 98,104 ****
}
else {
! DEBUG && _w( 1, "SERVER INIT: Adding ChildInitHandler for initialization" );
! Apache->push_handlers( PerlChildInitHandler => \&child_init );
}
}
--- 97,110 ----
}
else {
! unless ( $OpenInteract::is_initialized ) {
! DEBUG && _w( 1, "SERVER INIT: Adding ChildInitHandler for initialization" );
! Apache->push_handlers( PerlChildInitHandler => \&child_init );
! }
}
+
+ $OpenInteract::is_initialized++;
+ push @OpenInteract::to_initialize, [ $BASE_CONFIG->{website_dir},
+ $BASE_CONFIG->{stash_class} ];
+
}
***************
*** 106,120 ****
sub child_init {
my ( $r ) = @_;
!
! my $server = ( $r ) ? $r->server : Apache->server;
!
! my $stash_class = $server->dir_config( 'OIStashClass' );
! my $website_dir = $server->dir_config( 'OIRootDir' );
!
! DEBUG && _w( 1, "PerlChildInitHandler being executed for Child ($$) with stash ($stash_class)" );
!
! my $BASE_CONFIG = OpenInteract::Startup->read_base_config({ website_dir => $website_dir });
! unless ( $BASE_CONFIG ) { die "Cannot create base configuration from ($website_dir)!"; }
! DEBUG && _w( 1, "CHILD INIT: base configuration read in ok." );
# seed the random number generator per child -- note that we can
--- 112,116 ----
sub child_init {
my ( $r ) = @_;
! DEBUG && _w( 1, "CHILD INIT: Being executed for child ($$)" );
# seed the random number generator per child -- note that we can
***************
*** 124,172 ****
srand;
! # The big enchilada -- do just about everything here and get back the
! # list of classes that need to be initialized along with the config object.
! # Note that we do not pass the necessary parameters to initialize aliases
! # and to create/initialize the SPOPS classes -- we do that in the child
! # init handler below
! my ( $init_class, $C ) = OpenInteract::Startup->main_initialize({
! base_config => $BASE_CONFIG });
! unless ( $C ) { die "No configuration object returned from initialization!\n"; }
! DEBUG && _w( 1, "CHILD INIT: main initialization completed ok." );
! OpenInteract::Startup->require_module({ class => $C->{session_info}{class} });
! DEBUG && _w( 1, "CHILD INIT: require the session class ok" );
! # Figure out how to do this more cleanly in the near future -- maybe
! # just do it by hand for this special class?
- push @{ $init_class }, 'OpenInteract::PackageRepository';
! # Setup caching info for use in the child init handler below
! my $cache_info = $C->{cache_info}{data};
! my $cache_class = $cache_info->{class};
! my $ipc_cache_class = $C->{cache}{ipc}{class};
! $cache_class->class_initialize({ config => $C }) if ( $cache_info->{use} );
! $ipc_cache_class->class_initialize({ config => $C }) if ( $cache_info->{use_ipc} );
! # Tell OpenInteract::Request to setup aliases if it hasn't already
! my $REQUEST_CLASS = $BASE_CONFIG->{request_class};
! $REQUEST_CLASS->setup_aliases;
! DEBUG && _w( 1, "CHILD INIT: setup \$R aliases ok" );
! # Initialize all the SPOPS object classes
! OpenInteract::Startup->initialize_spops({ config => $C,
! class => $init_class });
! DEBUG && _w( 1, "CHILD INIT: initialize SPOPS classes ok" );
! # Create a list of error handlers for our website
! eval { OpenInteract::Error::Main->initialize({ config => $C }) };
! my $err_status = ( $@ ) ? $@ : 'ok';
! DEBUG && _w( 1, sprintf( "CHILD INIT: %-40s: %-30s","init: Error Dispatcher", $err_status ) );
}
--- 120,186 ----
srand;
! # Whenever we run a startup.pl for a vhost we push information
! # into the package variable @OpenInteract::to_initialize;
! foreach my $entry ( @OpenInteract::to_initialize ) {
! my $website_dir = $entry->[0];
! my $stash_class = $entry->[1];
! DEBUG && _w( 1, "CHILD INIT: In site root ($website_dir) with stash ($stash_class)" );
! my $BASE_CONFIG = OpenInteract::Startup->read_base_config({
! website_dir => $website_dir });
! unless ( $BASE_CONFIG ) {
! die "Cannot create base configuration from ($website_dir)!";
! }
! DEBUG && _w( 1, "CHILD INIT: base configuration read in ok." );
! # The big enchilada -- do just about everything here and get
! # back the list of classes that need to be initialized along
! # with the config object.
! my ( $init_class, $C ) = OpenInteract::Startup->main_initialize({
! base_config => $BASE_CONFIG });
! unless ( $C ) { die "No configuration object returned from initialization!\n"; }
! DEBUG && _w( 1, "CHILD INIT: main initialization completed ok." );
! OpenInteract::Startup->require_module({ class => $C->{session_info}{class} });
! DEBUG && _w( 1, "CHILD INIT: require the session class ok" );
! # Figure out how to do this more cleanly in the near future --
! # maybe just do it by hand for this special class?
! push @{ $init_class }, 'OpenInteract::PackageRepository';
! # Setup caching info for use in the child init handler below
! my $cache_info = $C->{cache_info}{data};
! my $cache_class = $cache_info->{class};
! my $ipc_cache_class = $C->{cache}{ipc}{class};
! $cache_class->class_initialize({ config => $C }) if ( $cache_info->{use} );
! $ipc_cache_class->class_initialize({ config => $C }) if ( $cache_info->{use_ipc} );
! # Tell OpenInteract::Request to setup aliases if it hasn't
! # already
!
! my $REQUEST_CLASS = $BASE_CONFIG->{request_class};
! $REQUEST_CLASS->setup_aliases;
! DEBUG && _w( 1, "CHILD INIT: setup \$R aliases ok" );
!
! # Initialize all the SPOPS object classes
!
! OpenInteract::Startup->initialize_spops({ config => $C,
! class => $init_class });
! DEBUG && _w( 1, "CHILD INIT: initialize SPOPS classes ok" );
!
! # Create a list of error handlers for our website
!
! eval { OpenInteract::Error::Main->initialize({ config => $C }) };
! my $err_status = ( $@ ) ? $@ : 'ok';
! DEBUG && _w( 1, sprintf( "CHILD INIT: %-40s: %-30s","init: Error Dispatcher", $err_status ) );
! }
! DEBUG && _w( 1, "CHILD INIT: All items initialized. Done." );
}
|