[Rt-commit] rt branch, 4.2/list-loaded-config-files, created. rt-4.0.6-446-g21aada8
Thomas Sibley
trs at bestpractical.com
Mon Aug 6 13:03:50 EDT 2012
The branch, 4.2/list-loaded-config-files has been created
at 21aada884b4414518fec62c10397b4322b31366c (commit)
- Log -----------------------------------------------------------------
commit 21aada884b4414518fec62c10397b4322b31366c
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Aug 6 09:57:23 2012 -0700
List the configuration files loaded on the System Configuration page
In load order (as wacky as it is), emphasized if treated as a site
config.
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index deb099b..5ad0180 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -806,6 +806,7 @@ EOT
},
);
my %OPTIONS = ();
+my @LOADED_CONFIGS = ();
=head1 METHODS
@@ -972,6 +973,14 @@ EOF
my $errormessage = sprintf( $message,
$file_path, $fileusername, $filegroup, $filegroup );
die "$errormessage\n$@";
+ } else {
+ # Loaded successfully
+ push @LOADED_CONFIGS, {
+ as => $args{'File'},
+ filename => $INC{ $args{'File'} },
+ extension => $is_ext,
+ site => $is_site,
+ };
}
return 1;
}
@@ -1008,6 +1017,40 @@ sub Configs {
return @configs;
}
+=head2 LoadedConfigs
+
+Returns a list of hashrefs, one for each config file loaded. The keys of the
+hashes are:
+
+=over 4
+
+=item as
+
+Name this config file was loaded as (relative filename usually).
+
+=item filename
+
+The full path and filename.
+
+=item extension
+
+The "extension" part of the filename. For example, the file C<RTIR_Config.pm>
+will have an C<extension> value of C<RTIR>.
+
+=item site
+
+True if the file is considered a site-level override. For example, C<site>
+will be false for C<RT_Config.pm> and true for C<RT_SiteConfig.pm>.
+
+=back
+
+=cut
+
+sub LoadedConfigs {
+ # Copy to avoid the caller changing our internal data
+ return map { \%$_ } @LOADED_CONFIGS
+}
+
=head2 Get
Takes name of the option as argument and returns its current value.
diff --git a/share/html/Admin/Tools/Configuration.html b/share/html/Admin/Tools/Configuration.html
index ed7d465..9113bad 100644
--- a/share/html/Admin/Tools/Configuration.html
+++ b/share/html/Admin/Tools/Configuration.html
@@ -187,6 +187,18 @@ for my $type (qw/Tickets Queues Transactions Groups PrivilegedUsers Unprivileged
</ol>
</&>
+<&|/Widgets/TitleBox, title=> loc("Loaded config files") &>
+<ol>
+% foreach my $config (RT->Config->LoadedConfigs) {
+% if ($config->{site}) {
+<li><strong><% $config->{filename} %></strong></li>
+% } else {
+<li><% $config->{filename} %></li>
+% }
+% }
+</ol>
+</&>
+
</td>
</table>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list