|
From: <ssc...@us...> - 2003-11-10 10:37:30
|
Update of /cvsroot/popfile/engine/POPFile
In directory sc8-pr-cvs1:/tmp/cvs-serv17911
Modified Files:
Loader.pm
Log Message:
Roadmap feature addition: Dis/enabling of optional POPFile Loadable Modules.
Updating past this point may require re-setting some modules as enabled
Optional modules (All Proxies, and non-html UI's) have a -module_enabled
boolean configuration parameter
Index: Loader.pm
===================================================================
RCS file: /cvsroot/popfile/engine/POPFile/Loader.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** Loader.pm 5 Nov 2003 15:08:23 -0000 1.12
--- Loader.pm 10 Nov 2003 10:37:27 -0000 1.13
***************
*** 7,13 ****
#
# Subroutine names beginning with CORE indicate a subroutine designed for exclusive use of
! # POPFile's core application (popfile.pl).
#
! # Subroutines not so marked are suitable for use by POPFile-based utilities to assist in loading
# and executing modules
#
--- 7,13 ----
#
# Subroutine names beginning with CORE indicate a subroutine designed for exclusive use of
! # POPFile's core application (popfile.pl).
#
! # Subroutines not so marked are suitable for use by POPFile-based utilities to assist in loading
# and executing modules
#
***************
*** 30,33 ****
--- 30,35 ----
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
+ # Modified by Sam Schinke (ssc...@us...)
+ #
# ---------------------------------------------------------------------------------------------
***************
*** 49,52 ****
--- 51,60 ----
$self->{components__} = {};
+ $self->{disabled_components__} = {};
+
+ # Do not allow disabling of the following components (group or name)
+
+ $self->{required_components__} = qr/^(core|html|bayes)$/;
+
# A handy boolean that tells us whether we are alive or not. When this is set to 1 then the
# proxy works normally, when set to 0 (typically by the aborting() function called from a signal)
***************
*** 534,537 ****
--- 542,546 ----
print '} ' if $self->{debug__};
}
+ print "\n";
}
***************
*** 565,569 ****
my ( $self ) = @_;
! print "\n\n Starting... " if $self->{debug__};
# Now that the configuration is set tell each module to begin operation
--- 574,578 ----
my ( $self ) = @_;
! print "\n Starting... " if $self->{debug__};
# Now that the configuration is set tell each module to begin operation
***************
*** 583,586 ****
--- 592,629 ----
print "\n\nPOPFile Engine ", scalar($self->CORE_version()), " running\n" if $self->{debug__};
flush STDOUT;
+ }
+
+ #---------------------------------------------------------------------------------------------
+ #
+ # CORE_enabled_check
+ #
+ # Prevents calling of start and service of disabled optional modules
+ #
+ #---------------------------------------------------------------------------------------------
+ sub CORE_enabled_check
+ {
+ my ( $self ) = @_;
+
+ # Check all currently enabled components
+
+ foreach my $type (keys %{$self->{components__}}) {
+ unless ( $type =~ $self->{required_components__} ) {
+ foreach my $name (keys %{$self->{components__}{$type}}) {
+ unless ( ( $name =~ $self->{required_components__} )
+ || ( defined($self->{components__}{$type}{$name}->config_( 'enabled' ) )
+ && $self->{components__}{$type}{$name}->config_( 'enabled' ) ) ) {
+
+ # If the component is optional and is disabled, move it to a holding
+ # hash. This is done this way to allow recovery/re-enabling of objects
+ # (eg, HUP) and to leave them intact for interface plugin configuration.
+ $self->{disabled_components__}{$type}{$name} = $self->{components__}{$type}{$name};
+ delete $self->{components__}{$type}{$name};
+ }
+ }
+ }
+ }
+
+ # Re-enable any disabled components that are now enabled
+ # TODO: implement this when POPFile needs to be able to handle a HUP.
}
|