[Rt-commit] r3982 - in rt/branches/3.7-EXPERIMENTAL: . lib
ruz at bestpractical.com
ruz at bestpractical.com
Thu Oct 20 01:14:29 EDT 2005
Author: ruz
Date: Thu Oct 20 01:14:29 2005
New Revision: 3982
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/lib/RT.pm.in
Log:
r1144 at cubic-pc: cubic | 2005-10-13 16:53:14 +0400
r1140 at cubic-pc: cubic | 2005-10-13 15:43:32 +0400
work on the RT config handling
r1143 at cubic-pc: cubic | 2005-10-13 16:52:08 +0400
Changes:
* simple extensions config loading
Full config handling rework(http://rt3.fsck.com/Ticket/Display.html?id=7051)
is too complex and backward incompatible and would be merged later.
This change is subset of the full patch.
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT.pm.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT.pm.in (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT.pm.in Thu Oct 20 01:14:29 2005
@@ -126,13 +126,38 @@
=cut
sub LoadConfig {
- local *Set = sub { $_[0] = $_[1] unless defined $_[0] };
- if ( -f "$SITE_CONFIG_FILE" ) {
- require $SITE_CONFIG_FILE
- || die ("Couldn't load RT config file '$SITE_CONFIG_FILE'\n$@");
+
+ # get list of the core config files
+ my @configs = ();
+ foreach my $path( $RT::LocalEtcPath, $RT::EtcPath ) {
+ my $mask = File::Spec->catfile($path, "*_Config.pm");
+ my @files = glob $mask;
+ @files = grep { $_ !~ /^RT_Config\.pm$/ }
+ grep { $_ && /^\w+_Config\.pm$/ }
+ map { s/^.*[\\\/]//; $_ } @files;
+ push @configs, @files;
+ }
+ @configs = sort @configs;
+ unshift(@configs, 'RT_Config.pm');
+
+ foreach my $file( @configs ) {
+ local @INC = ( $RT::LocalEtcPath, $RT::EtcPath, @INC );
+ local *Set = sub { $_[0] = $_[1] unless defined $_[0] };
+
+ # load site config
+ my $site_file = $file;
+ $site_file =~ s/(?=Config\.pm$)/Site/;
+ eval { require $site_file };
+ if( $@ && $@ !~ qr{^Can't locate \Q$site_file} ) {
+ die "Couldn't load site config file '$site_file': $@";
+ }
+
+ # load core config
+ eval { require $file };
+ if( $@ ) {
+ die "Couldn't load core config file '$file': $@";
+ }
}
- require $CORE_CONFIG_FILE
- || die ("Couldn't load RT config file '$CORE_CONFIG_FILE'\n$@");
RT::I18N->Init;
}
More information about the Rt-commit
mailing list