summaryrefslogtreecommitdiff
path: root/rt/share/html/Admin/Tools/Configuration.html
blob: 9643b7bfcb1288d15a860cf4a4c71d6e4c797d74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
%# BEGIN BPS TAGGED BLOCK {{{
%#
%# COPYRIGHT:
%#
%# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC
%#                                          <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
%#
%#
%# LICENSE:
%#
%# This work is made available to you under the terms of Version 2 of
%# the GNU General Public License. A copy of that license should have
%# been provided with this software, but in any event can be snarfed
%# from www.gnu.org.
%#
%# This work is distributed in the hope that it will be useful, but
%# WITHOUT ANY WARRANTY; without even the implied warranty of
%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
%# General Public License for more details.
%#
%# You should have received a copy of the GNU General Public License
%# along with this program; if not, write to the Free Software
%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
%# 02110-1301 or visit their web page on the internet at
%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
%#
%#
%# CONTRIBUTION SUBMISSION POLICY:
%#
%# (The following paragraph is not intended to limit the rights granted
%# to you to modify and distribute this software under the terms of
%# the GNU General Public License and is only of importance to you if
%# you choose to contribute your changes and enhancements to the
%# community by submitting them to Best Practical Solutions, LLC.)
%#
%# By intentionally submitting any modifications, corrections or
%# derivatives to this work, or any other work intended for use with
%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
%# you are the copyright holder for those contributions and you grant
%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
%# royalty-free, perpetual, license to use, copy, create derivative
%# works based on those contributions, and sublicense and distribute
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
<%init>
require  Module::Versions::Report;
my $title = loc('System Configuration');
unless ($session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'SuperUser')) {
 Abort(loc('This feature is only available to system administrators'));
}
</%init>
<& /Admin/Elements/Header, Title => $title &>
<& /Elements/Tabs &>

<&|/Widgets/TitleBox, title => loc("RT Configuration") &>
<table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
<tr class="collection-as-table">
<th class="collection-as-table"><&|/l&>Option</&></th>
<th class="collection-as-table"><&|/l&>Value</&></th>
<th class="collection-as-table"><&|/l&>Source</&></th>
</tr>
<%PERL>
my $index_conf;
foreach my $key ( RT->Config->Options( Overridable => undef, Sorted => 0 ) ) {
    my $val = RT->Config->GetObfuscated( $key, $session{'CurrentUser'} );
    next unless defined $val;

    my $meta = RT->Config->Meta( $key );
    my $description = '';
    if ( $meta->{'Source'}{'Extension'} && $meta->{'Source'}{'SiteConfig'} ) {
        $description = loc("[_1] site config", $meta->{'Source'}{'Extension'});
    }
    elsif ( $meta->{'Source'}{'Extension'} ) {
        $description = loc("[_1] core config", $meta->{'Source'}{'Extension'});
    }
    elsif ( $meta->{'Source'}{'SiteConfig'} ) {
        $description = loc("site config");
    }
    else {
        $description = loc("core config");
    }
    $index_conf++;
</%PERL>
<tr class="<% $index_conf%2 ? 'oddline' : 'evenline'%>">
<td class="collection-as-table"><% $key %></td>
<td class="collection-as-table">
% if ( $key =~ /Password/i and $key !~ /MinimumPasswordLength|AllowLoginPasswordAutoComplete/ ) {
<em><% loc('Password not printed' ) %></em>\
% } else {
<% stringify($val) |n %>\
% }
</td>
<td class="collection-as-table" style="white-space: nowrap">
% if ( $meta->{'Source'}{'SiteConfig'} ) {
<span style="font-weight: bold"><% $description %></span>
% } else {
<% $description %>
% }
</td>
</tr>
% }
</table>
</&>
<table width="100%">
    <tr>
        <td valign="top" width="60%" class="boxcontainer">
<&|/Widgets/TitleBox, title=> loc("RT core variables") &>
<table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
<tr class="collection-as-table">
<th class="collection-as-table"><&|/l&>Variable</&></th>
<th class="collection-as-table"><&|/l&>Value</&></th>
</tr>
<%PERL>
{ no strict qw/refs/;
my %config_opt = map { $_ => 1 } RT->Config->Options( Overridable => undef );
my $index_var;
foreach my $key ( sort keys %{*RT::} ) {
    next if !${'RT::'.$key} || ref ${'RT::'.$key} || $config_opt{ $key };
    $index_var++;
</%PERL>
<tr class="collection-as-table <% $index_var%2 ? 'oddline' : 'evenline'%>">
<td class="collection-as-table">RT::<% $key %></td>
<td class="collection-as-table">
% if ( $key =~ /Password(?!Length)/i ) { 
<em><% loc('Password not printed' ) %></em>\
% } else {
<% ${'RT::'.$key} %>
% }
</td>
</tr>
% }
% }
</table>
</&>

<&|/Widgets/TitleBox, title => loc("RT Size") &>
<table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
<tr class="collection-as-table">
<th class="collection-as-table"><&|/l&>Object</&></th>
<th class="collection-as-table"><&|/l&>Size</&></th>
</tr>
<%PERL>
my ($index_size, $user_count, $privileged_count);
for my $type (qw/Tickets Queues Transactions Groups PrivilegedUsers UnprivilegedUsers/) {
    my $count;
    my $class = 'RT::' . $type;
    $class =~ s/Privileged|Unprivileged//;
    my $collection = $class->new(RT->SystemUser);
    $collection->UnLimit;
    $collection->FindAllRows;   # find disabled
    if ($type =~ /PrivilegedUsers/) {
        $user_count = $collection->CountAll;
        $collection->LimitToPrivileged;
        $count = $privileged_count = $collection->CountAll;
    } elsif ($type =~ /UnprivilegedUsers/) {
        $count = $user_count - $privileged_count;
    } else {
        $count = $collection->CountAll;
    }
    $index_size++;
</%PERL>
<tr class="<% $index_size%2 ? 'oddline' : 'evenline'%>">
<td class="collection-as-table"><% $type %></td>
<td class="collection-as-table"><% $count %></td>
</tr>
% }
</table>
</&>
</td>
<td valign="top" class="boxcontainer">

<&|/Widgets/TitleBox, title => loc("Mason template search order") &>
<ol>
% foreach my $path ( RT::Interface::Web->ComponentRoots ) {
<li><% $path %></li>
% }
</ol>
</&>

<&|/Widgets/TitleBox, title => loc("Static file search order") &>
<ol>
% foreach my $path ( (map {$_->{root}} RT->Config->Get('StaticRoots')),
%                    RT::Interface::Web->StaticRoots ) {
<li><% $path %></li>
% }
</ol>
</&>

<&|/Widgets/TitleBox, title => loc("Perl library search order") &>
<ol>
% foreach my $inc (@INC) {
<li><% $inc %></li>
% }
</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>
</&>

<&|/Widgets/TitleBox, title=> loc("Logging summary") &>
  <& /Admin/Elements/LoggingSummary &>
</&>

</td>
</table>

<&|/Widgets/TitleBox, title => loc("Global Attributes") &>
<table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
<tr class="collection-as-table">
<th class="collection-as-table"><&|/l&>Name</&></th>
<th class="collection-as-table"><&|/l&>Value</&></th>
</tr>
% my $attrs = $RT::System->Attributes;
% my $index_size = 0;
% while ( my $attr = $attrs->Next ) {
% next if $attr->Name eq 'UpgradeHistory';
<tr class="<% $index_size%2 ? 'oddline' : 'evenline'%>">
% if ($attr->Name eq 'UserLogo') {
%   my $content = $attr->Content;
%   $content->{data} = defined $content->{data} ? 'DATA' : 'undef'
%       if exists $content->{data};
<td><% $attr->Name %></td><td><% stringify($content) |n %></td>
% } else {
<td><% $attr->Name %></td><td><% stringify($attr->Content) |n %></td>
% }
</tr>
% $index_size++;
% }
</table>
</&>


<&|/Widgets/TitleBox, title => loc("Loaded RT Extensions")&>
<table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
<tr class="collection-as-table">
<th class="collection-as-table"><&|/l&>Extension</&></th>
<th class="collection-as-table"><&|/l&>Version</&></th>
% my $row = 0;
% foreach my $pluginName (grep $_, RT->Config->Get('Plugins')) {
% my $plugin = RT::Plugin->new( name => $pluginName );
<tr class="<% $row++ %2 ? 'oddline' : 'evenline'%>">
<td class="collection-as-table"><%$plugin->Name%></td>
<td class="collection-as-table"><%$plugin->Version%></td>
</tr>
% }
</table>
</&>

<&|/Widgets/TitleBox, title => loc("Loaded perl modules")&>
<table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
<tr class="collection-as-table">
<th class="collection-as-table"><&|/l&>Module</&></th>
<th class="collection-as-table"><&|/l&>Version</&></th>
<th class="collection-as-table"><&|/l&>Source</&></th>


<%perl>
my $i = 0;
my $report = Module::Versions::Report::report();
my @report = grep /v\d/, split("\n",$report);
shift @report; # throw away the perl version
my ($ver, $source, $distfile);
foreach my $item (@report) {
if ($item =~ /^\s*(.*?)\s*v(\S+);/) {
    $item = $1;
    $ver = $2;
    $distfile = $item.".pm";
    $distfile =~ s|::|/|g;
}
</%perl>
<tr class="<% $i++ %2 ? 'oddline' : 'evenline'%>">
<td class="collection-as-table"><% $item %></td>
    <td class="collection-as-table">
        <%$ver%>
    </td>
    <td class="collection-as-table">
        <% $INC{$distfile} || '' %>
    </td>
</tr>
% }
</table>
</&>

<&|/Widgets/TitleBox, title => loc("RT upgrade history")&>
<& /Admin/Elements/UpgradeHistory &>
</&>

<&|/Widgets/TitleBox, title => loc("Perl configuration") &>
% require Config;
<pre>
<% Config::myconfig() %>
</pre>
</&>

<&|/Widgets/TitleBox, title=> loc("Environment variables") &>
<table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
<tr class="collection-as-table">
<th class="collection-as-table"><&|/l&>Variable</&></th>
<th class="collection-as-table"><&|/l&>Value</&></th>
</tr>
% my $row = 0;
% for my $key (sort keys %ENV) {
<tr class="collection-as-table <% $row++ %2 ? 'oddline' : 'evenline'%>">
<td class="collection-as-table"><% $key %></td>
<td class="collection-as-table"><% $ENV{$key} %></td>
</tr>
% }
</table>
</&>

<&|/Widgets/TitleBox, title => loc("Operating System") &>
<table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
<tr class="collection-as-table evenline">
<td class="collection-as-table">Deployment type</td>
<td class="collection-as-table"><%
  $INC{'mod_perl.pm'} ? "mod_perl" :
  $INC{'FCGI.pm'}     ? "fastcgi"  :
                        "standalone" %>
</td>
</tr>
<%perl>
my @os = (
    "Distribution"   => 'lsb_release --all',
    "uname -a"       => 'uname -a',
    "SELinux status" => 'getenforce',
    "Apache"         => [map { "$_ -V" } qw(apache2ctl apachectl httpdctl)],
    "nginx"          => 'nginx -V 2>&1',
    "lighttpd"       => 'lighttpd -V',
);
my @os_info;

while (my ($name, $cmd) = splice @os, 0, 2) {
    $cmd = [$cmd] unless ref $cmd eq 'ARRAY';
    for my $run (@$cmd) {
        $run .= " </dev/null";
        $run .= " 2>/dev/null" unless $run =~ /2>/;
        my $result = `$run`;
        if (defined $result and $result =~ /\S/) {
            push @os_info, $name => $result;
            last;
        }
    }
}
my $row = 1;
</%perl>
% while (my ($name, $output) = splice @os_info, 0, 2) {
<tr class="collection-as-table <% $row++ % 2 ? "oddline" : "evenline" %>">
<td class="collection-as-table"><% $name %></td>
<td class="collection-as-table" style="white-space: pre-wrap; font-family: monospace"><% $output %></td>
</tr>
% }
</table>
</&>

<%INIT>
use Data::Dumper;
local $Data::Dumper::Terse = 1;
local $Data::Dumper::Indent = 2;

sub stringify {
    my $value = shift;
    my $output = Dumper $value;
    RT::Interface::Web::EscapeHTML(\$output);
    $output =~ s/ /&nbsp;/g;
    $output =~ s!\n!<br />!g;
    return $output;
}
</%INIT>