rt 4.2.15
[freeside.git] / rt / share / html / Admin / Tools / Configuration.html
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %#
3 %# COPYRIGHT:
4 %#
5 %# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
6 %#                                          <sales@bestpractical.com>
7 %#
8 %# (Except where explicitly superseded by other copyright notices)
9 %#
10 %#
11 %# LICENSE:
12 %#
13 %# This work is made available to you under the terms of Version 2 of
14 %# the GNU General Public License. A copy of that license should have
15 %# been provided with this software, but in any event can be snarfed
16 %# from www.gnu.org.
17 %#
18 %# This work is distributed in the hope that it will be useful, but
19 %# WITHOUT ANY WARRANTY; without even the implied warranty of
20 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21 %# General Public License for more details.
22 %#
23 %# You should have received a copy of the GNU General Public License
24 %# along with this program; if not, write to the Free Software
25 %# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 %# 02110-1301 or visit their web page on the internet at
27 %# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
28 %#
29 %#
30 %# CONTRIBUTION SUBMISSION POLICY:
31 %#
32 %# (The following paragraph is not intended to limit the rights granted
33 %# to you to modify and distribute this software under the terms of
34 %# the GNU General Public License and is only of importance to you if
35 %# you choose to contribute your changes and enhancements to the
36 %# community by submitting them to Best Practical Solutions, LLC.)
37 %#
38 %# By intentionally submitting any modifications, corrections or
39 %# derivatives to this work, or any other work intended for use with
40 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
41 %# you are the copyright holder for those contributions and you grant
42 %# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
43 %# royalty-free, perpetual, license to use, copy, create derivative
44 %# works based on those contributions, and sublicense and distribute
45 %# those contributions and any derivatives thereof.
46 %#
47 %# END BPS TAGGED BLOCK }}}
48 <%init>
49 require  Module::Versions::Report;
50 my $title = loc('System Configuration');
51 unless ($session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'SuperUser')) {
52  Abort(loc('This feature is only available to system administrators'));
53 }
54 </%init>
55 <& /Admin/Elements/Header, Title => $title &>
56 <& /Elements/Tabs &>
57
58 <&|/Widgets/TitleBox, title => loc("RT Configuration") &>
59 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
60 <tr class="collection-as-table">
61 <th class="collection-as-table"><&|/l&>Option</&></th>
62 <th class="collection-as-table"><&|/l&>Value</&></th>
63 <th class="collection-as-table"><&|/l&>Source</&></th>
64 </tr>
65 <%PERL>
66 my $index_conf;
67 foreach my $key ( RT->Config->Options( Overridable => undef, Sorted => 0 ) ) {
68     my $val = RT->Config->GetObfuscated( $key, $session{'CurrentUser'} );
69     next unless defined $val;
70
71     my $meta = RT->Config->Meta( $key );
72     my $description = '';
73     if ( $meta->{'Source'}{'Extension'} && $meta->{'Source'}{'SiteConfig'} ) {
74         $description = loc("[_1] site config", $meta->{'Source'}{'Extension'});
75     }
76     elsif ( $meta->{'Source'}{'Extension'} ) {
77         $description = loc("[_1] core config", $meta->{'Source'}{'Extension'});
78     }
79     elsif ( $meta->{'Source'}{'SiteConfig'} ) {
80         $description = loc("site config");
81     }
82     else {
83         $description = loc("core config");
84     }
85     $index_conf++;
86 </%PERL>
87 <tr class="<% $index_conf%2 ? 'oddline' : 'evenline'%>">
88 <td class="collection-as-table"><% $key %></td>
89 <td class="collection-as-table">
90 % if ( $key =~ /Password/i and $key !~ /MinimumPasswordLength|AllowLoginPasswordAutoComplete/ ) {
91 <em><% loc('Password not printed' ) %></em>\
92 % } else {
93 <% stringify($val) |n %>\
94 % }
95 </td>
96 <td class="collection-as-table" style="white-space: nowrap">
97 % if ( $meta->{'Source'}{'SiteConfig'} ) {
98 <span style="font-weight: bold"><% $description %></span>
99 % } else {
100 <% $description %>
101 % }
102 </td>
103 </tr>
104 % }
105 </table>
106 </&>
107 <table width="100%">
108     <tr>
109         <td valign="top" width="60%" class="boxcontainer">
110 <&|/Widgets/TitleBox, title=> loc("RT core variables") &>
111 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
112 <tr class="collection-as-table">
113 <th class="collection-as-table"><&|/l&>Variable</&></th>
114 <th class="collection-as-table"><&|/l&>Value</&></th>
115 </tr>
116 <%PERL>
117 { no strict qw/refs/;
118 my %config_opt = map { $_ => 1 } RT->Config->Options( Overridable => undef );
119 my $index_var;
120 foreach my $key ( sort keys %{*RT::} ) {
121     next if !${'RT::'.$key} || ref ${'RT::'.$key} || $config_opt{ $key };
122     $index_var++;
123 </%PERL>
124 <tr class="collection-as-table <% $index_var%2 ? 'oddline' : 'evenline'%>">
125 <td class="collection-as-table">RT::<% $key %></td>
126 <td class="collection-as-table">
127 % if ( $key =~ /Password(?!Length)/i ) { 
128 <em><% loc('Password not printed' ) %></em>\
129 % } else {
130 <% ${'RT::'.$key} %>
131 % }
132 </td>
133 </tr>
134 % }
135 % }
136 </table>
137 </&>
138
139 <&|/Widgets/TitleBox, title => loc("RT Size") &>
140 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
141 <tr class="collection-as-table">
142 <th class="collection-as-table"><&|/l&>Object</&></th>
143 <th class="collection-as-table"><&|/l&>Size</&></th>
144 </tr>
145 <%PERL>
146 my ($index_size, $user_count, $privileged_count);
147 for my $type (qw/Tickets Queues Transactions Groups PrivilegedUsers UnprivilegedUsers/) {
148     my $count;
149     my $class = 'RT::' . $type;
150     $class =~ s/Privileged|Unprivileged//;
151     my $collection = $class->new(RT->SystemUser);
152     $collection->UnLimit;
153     $collection->FindAllRows;   # find disabled
154     if ($type =~ /PrivilegedUsers/) {
155         $user_count = $collection->CountAll;
156         $collection->LimitToPrivileged;
157         $count = $privileged_count = $collection->CountAll;
158     } elsif ($type =~ /UnprivilegedUsers/) {
159         $count = $user_count - $privileged_count;
160     } else {
161         $count = $collection->CountAll;
162     }
163     $index_size++;
164 </%PERL>
165 <tr class="<% $index_size%2 ? 'oddline' : 'evenline'%>">
166 <td class="collection-as-table"><% $type %></td>
167 <td class="collection-as-table"><% $count %></td>
168 </tr>
169 % }
170 </table>
171 </&>
172 </td>
173 <td valign="top" class="boxcontainer">
174
175 <&|/Widgets/TitleBox, title => loc("Mason template search order") &>
176 <ol>
177 % foreach my $path ( RT::Interface::Web->ComponentRoots ) {
178 <li><% $path %></li>
179 % }
180 </ol>
181 </&>
182
183 <&|/Widgets/TitleBox, title => loc("Static file search order") &>
184 <ol>
185 % foreach my $path ( (map {$_->{root}} RT->Config->Get('StaticRoots')),
186 %                    RT::Interface::Web->StaticRoots ) {
187 <li><% $path %></li>
188 % }
189 </ol>
190 </&>
191
192 <&|/Widgets/TitleBox, title => loc("Perl library search order") &>
193 <ol>
194 % foreach my $inc (@INC) {
195 <li><% $inc %></li>
196 % }
197 </ol>
198 </&>
199
200 <&|/Widgets/TitleBox, title=> loc("Loaded config files") &>
201 <ol>
202 % foreach my $config (RT->Config->LoadedConfigs) {
203 %   if ($config->{site}) {
204 <li><strong><% $config->{filename} %></strong></li>
205 %   } else {
206 <li><% $config->{filename} %></li>
207 %   }
208 % }
209 </ol>
210 </&>
211
212 <&|/Widgets/TitleBox, title=> loc("Logging summary") &>
213   <& /Admin/Elements/LoggingSummary &>
214 </&>
215
216 </td>
217 </table>
218
219 <&|/Widgets/TitleBox, title => loc("Global Attributes") &>
220 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
221 <tr class="collection-as-table">
222 <th class="collection-as-table"><&|/l&>Name</&></th>
223 <th class="collection-as-table"><&|/l&>Value</&></th>
224 </tr>
225 % my $attrs = $RT::System->Attributes;
226 % my $index_size = 0;
227 % while ( my $attr = $attrs->Next ) {
228 % next if $attr->Name eq 'UpgradeHistory';
229 <tr class="<% $index_size%2 ? 'oddline' : 'evenline'%>">
230 % if ($attr->Name eq 'UserLogo') {
231 %   my $content = $attr->Content;
232 %   $content->{data} = defined $content->{data} ? 'DATA' : 'undef'
233 %       if exists $content->{data};
234 <td><% $attr->Name %></td><td><% stringify($content) |n %></td>
235 % } else {
236 <td><% $attr->Name %></td><td><% stringify($attr->Content) |n %></td>
237 % }
238 </tr>
239 % $index_size++;
240 % }
241 </table>
242 </&>
243
244
245 <&|/Widgets/TitleBox, title => loc("Loaded RT Extensions")&>
246 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
247 <tr class="collection-as-table">
248 <th class="collection-as-table"><&|/l&>Extension</&></th>
249 <th class="collection-as-table"><&|/l&>Version</&></th>
250 % my $row = 0;
251 % foreach my $pluginName (grep $_, RT->Config->Get('Plugins')) {
252 % my $plugin = RT::Plugin->new( name => $pluginName );
253 <tr class="<% $row++ %2 ? 'oddline' : 'evenline'%>">
254 <td class="collection-as-table"><%$plugin->Name%></td>
255 <td class="collection-as-table"><%$plugin->Version%></td>
256 </tr>
257 % }
258 </table>
259 </&>
260
261 <&|/Widgets/TitleBox, title => loc("Loaded perl modules")&>
262 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
263 <tr class="collection-as-table">
264 <th class="collection-as-table"><&|/l&>Module</&></th>
265 <th class="collection-as-table"><&|/l&>Version</&></th>
266 <th class="collection-as-table"><&|/l&>Source</&></th>
267
268
269 <%perl>
270 my $i = 0;
271 my $report = Module::Versions::Report::report();
272 my @report = grep /v\d/, split("\n",$report);
273 shift @report; # throw away the perl version
274 my ($ver, $source, $distfile);
275 foreach my $item (@report) {
276 if ($item =~ /^\s*(.*?)\s*v(\S+);/) {
277     $item = $1;
278     $ver = $2;
279     $distfile = $item.".pm";
280     $distfile =~ s|::|/|g;
281 }
282 </%perl>
283 <tr class="<% $i++ %2 ? 'oddline' : 'evenline'%>">
284 <td class="collection-as-table"><% $item %></td>
285     <td class="collection-as-table">
286         <%$ver%>
287     </td>
288     <td class="collection-as-table">
289         <% $INC{$distfile} || '' %>
290     </td>
291 </tr>
292 % }
293 </table>
294 </&>
295
296 <&|/Widgets/TitleBox, title => loc("RT upgrade history")&>
297 <& /Admin/Elements/UpgradeHistory &>
298 </&>
299
300 <&|/Widgets/TitleBox, title => loc("Perl configuration") &>
301 % require Config;
302 <pre>
303 <% Config::myconfig() %>
304 </pre>
305 </&>
306
307 <&|/Widgets/TitleBox, title=> loc("Environment variables") &>
308 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
309 <tr class="collection-as-table">
310 <th class="collection-as-table"><&|/l&>Variable</&></th>
311 <th class="collection-as-table"><&|/l&>Value</&></th>
312 </tr>
313 % my $row = 0;
314 % for my $key (sort keys %ENV) {
315 <tr class="collection-as-table <% $row++ %2 ? 'oddline' : 'evenline'%>">
316 <td class="collection-as-table"><% $key %></td>
317 <td class="collection-as-table"><% $ENV{$key} %></td>
318 </tr>
319 % }
320 </table>
321 </&>
322
323 <&|/Widgets/TitleBox, title => loc("Operating System") &>
324 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
325 <tr class="collection-as-table evenline">
326 <td class="collection-as-table">Deployment type</td>
327 <td class="collection-as-table"><%
328   $INC{'mod_perl.pm'} ? "mod_perl" :
329   $INC{'FCGI.pm'}     ? "fastcgi"  :
330                         "standalone" %>
331 </td>
332 </tr>
333 <%perl>
334 my @os = (
335     "Distribution"   => 'lsb_release --all',
336     "uname -a"       => 'uname -a',
337     "SELinux status" => 'getenforce',
338     "Apache"         => [map { "$_ -V" } qw(apache2ctl apachectl httpdctl)],
339     "nginx"          => 'nginx -V 2>&1',
340     "lighttpd"       => 'lighttpd -V',
341 );
342 my @os_info;
343
344 while (my ($name, $cmd) = splice @os, 0, 2) {
345     $cmd = [$cmd] unless ref $cmd eq 'ARRAY';
346     for my $run (@$cmd) {
347         $run .= " </dev/null";
348         $run .= " 2>/dev/null" unless $run =~ /2>/;
349         my $result = `$run`;
350         if (defined $result and $result =~ /\S/) {
351             push @os_info, $name => $result;
352             last;
353         }
354     }
355 }
356 my $row = 1;
357 </%perl>
358 % while (my ($name, $output) = splice @os_info, 0, 2) {
359 <tr class="collection-as-table <% $row++ % 2 ? "oddline" : "evenline" %>">
360 <td class="collection-as-table"><% $name %></td>
361 <td class="collection-as-table" style="white-space: pre-wrap; font-family: monospace"><% $output %></td>
362 </tr>
363 % }
364 </table>
365 </&>
366
367 <%INIT>
368 use Data::Dumper;
369 local $Data::Dumper::Terse = 1;
370 local $Data::Dumper::Indent = 2;
371
372 sub stringify {
373     my $value = shift;
374     my $output = Dumper $value;
375     RT::Interface::Web::EscapeHTML(\$output);
376     $output =~ s/ /&nbsp;/g;
377     $output =~ s!\n!<br />!g;
378     return $output;
379 }
380 </%INIT>