[Rt-commit] rt branch, 4.4/siteconfig.d, created. rt-4.2.3-203-gec24ba4
? sunnavy
sunnavy at bestpractical.com
Thu Jun 26 14:04:41 EDT 2014
The branch, 4.4/siteconfig.d has been created
at ec24ba46f8421fe8d46119a6dd551c87ba953388 (commit)
- Log -----------------------------------------------------------------
commit ec24ba46f8421fe8d46119a6dd551c87ba953388
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Jun 27 00:16:39 2014 +0800
support config files in RT_SiteConfig.d
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 40dcec1..995d7e3 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -1015,13 +1015,19 @@ sub LoadConfig {
my $self = shift;
my %args = ( File => '', @_ );
$args{'File'} =~ s/(?<!Site)(?=Config\.pm$)/Site/;
- if ( $args{'File'} eq 'RT_SiteConfig.pm'
- and my $site_config = $ENV{RT_SITE_CONFIG} )
- {
- $self->_LoadConfig( %args, File => $site_config );
+ if ( $args{'File'} eq 'RT_SiteConfig.pm' ) {
+ my $load = $ENV{RT_SITE_CONFIG} || $args{'File'};
+ $self->_LoadConfig( %args, File => $load );
# to allow load siteconfig again and again in case it's updated
- delete $INC{ $site_config };
- } else {
+ delete $INC{$load};
+
+ my $dir = $ENV{RT_SITE_CONFIG_DIR} || "$RT::EtcPath/RT_SiteConfig.d";
+ for my $file ( <$dir/*.pm> ) {
+ $self->_LoadConfig( %args, File => $file, Site => 1, Extension => '' );
+ delete $INC{$file};
+ }
+ }
+ else {
$self->_LoadConfig(%args);
delete $INC{$args{'File'}};
}
@@ -1036,7 +1042,11 @@ sub _LoadConfig {
my %args = ( File => '', @_ );
my ($is_ext, $is_site);
- if ( $args{'File'} eq ($ENV{RT_SITE_CONFIG}||'') ) {
+ if ( defined $args{Site} && defined $args{Extension} ) {
+ $is_ext = $args{Extension};
+ $is_site = $args{Site};
+ }
+ elsif ( $args{'File'} eq ($ENV{RT_SITE_CONFIG}||'') ) {
($is_ext, $is_site) = ('', 1);
} else {
$is_ext = $args{'File'} =~ /^(?!RT_)(?:(.*)_)(?:Site)?Config/ ? $1 : '';
-----------------------------------------------------------------------
More information about the rt-commit
mailing list