| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# -*- perl -*- |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# $Id: SystemInfo.pm,v 1.10 2005/01/10 08:30:43 eserte Exp $ |
|
5
|
|
|
|
|
|
|
# Author: Slaven Rezic |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
# Copyright (C) 2004 Slaven Rezic. All rights reserved. |
|
8
|
|
|
|
|
|
|
# This package is free software; you can redistribute it and/or |
|
9
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
|
10
|
|
|
|
|
|
|
# |
|
11
|
|
|
|
|
|
|
# Mail: eserte@users.sourceforge.net |
|
12
|
|
|
|
|
|
|
# WWW: http://www.sourceforge.net/projects/we-framework |
|
13
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package WebEditor::OldFeatures::SystemInfo; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
WebEditor::OldFeatures::SystemInfo - return system information |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use mixin 'WebEditor::OldFeatures::SystemInfo'; |
|
24
|
|
|
|
|
|
|
print $self->system_info_as_html(); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
This module returns information about the current system. |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 CAVEATS |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
This module may return too much information about the system, e.g. |
|
33
|
|
|
|
|
|
|
system passwords which are stored in cookies or configuration objects. |
|
34
|
|
|
|
|
|
|
You should not let unauthorized users to call this feature! |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 AUTHOR |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Slaven Rezic |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
|
41
|
|
|
|
|
|
|
|
|
42
|
1
|
|
|
1
|
|
1071
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
32
|
|
|
43
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
60
|
|
|
44
|
|
|
|
|
|
|
$VERSION = sprintf("%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/); |
|
45
|
|
|
|
|
|
|
|
|
46
|
1
|
|
|
1
|
|
7
|
use mixin::with 'WebEditor::OldController'; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
10
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub system_info_as_html { |
|
49
|
0
|
|
|
0
|
0
|
|
my($self, %args) = @_; |
|
50
|
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
local $Data::Dumper::Sortkeys = 1; |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
my $uname_a = eval { `uname -a` }; |
|
|
0
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $linux_release = ""; |
|
56
|
0
|
|
|
|
|
|
eval { |
|
57
|
0
|
|
|
|
|
|
my @release_f = glob("/etc/*-release"); |
|
58
|
0
|
|
|
|
|
|
for my $f (@release_f) { |
|
59
|
0
|
0
|
|
|
|
|
if (open(F, $f)) { |
|
60
|
0
|
|
|
|
|
|
local $/ = undef; |
|
61
|
|
|
|
|
|
|
# Can't do this in one line (problem only apparent with |
|
62
|
|
|
|
|
|
|
# perl5.8.0 and mod_perl operation, but not cgi operation) |
|
63
|
0
|
|
|
|
|
|
my $add = ; |
|
64
|
0
|
|
|
|
|
|
$linux_release .= $add; |
|
65
|
0
|
|
|
|
|
|
close F; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
}; |
|
69
|
0
|
0
|
|
|
|
|
if ($@) { |
|
70
|
0
|
|
|
|
|
|
$linux_release .= $@; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
0
|
0
|
|
|
|
|
if ($linux_release ne "") { |
|
73
|
0
|
|
|
|
|
|
$linux_release = <
|
|
74
|
|
|
|
|
|
|
Linux distribution version (if applicable): |
|
75
|
|
|
|
|
|
|
$linux_release |
|
76
|
|
|
|
|
|
|
EOF |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
my $perl_version = "perl $]\n"; |
|
81
|
0
|
|
|
|
|
|
eval { |
|
82
|
0
|
|
|
|
|
|
require Config; |
|
83
|
0
|
|
|
|
|
|
$perl_version .= Config::myconfig(); |
|
84
|
0
|
|
|
|
|
|
$perl_version .= "\n\@INC:\n" . join(",\n", map { "\t$_" } @INC); |
|
|
0
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
}; |
|
86
|
0
|
0
|
|
|
|
|
$perl_version .= $@ if $@; |
|
87
|
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my $apache_version = $ENV{SERVER_SOFTWARE}; |
|
89
|
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
my $operation_mode; |
|
91
|
0
|
0
|
|
|
|
|
if ($ENV{MOD_PERL}) { |
|
92
|
0
|
|
|
|
|
|
$operation_mode .= "Running under mod_perl ($ENV{GATEWAY_INTERFACE})\n"; |
|
93
|
0
|
0
|
|
|
|
|
if (!$self->R) { |
|
94
|
0
|
|
|
|
|
|
$operation_mode .= "Probably Apache::Registry or similar operation mode.\n"; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
} else { |
|
97
|
0
|
|
|
|
|
|
$operation_mode .= "Running as cgi-bin ($ENV{GATEWAY_INTERFACE})\n"; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
my $get_versions; |
|
101
|
|
|
|
|
|
|
$get_versions = sub { |
|
102
|
0
|
|
|
0
|
|
|
my($module, $no_recurse, $level) = @_; |
|
103
|
0
|
0
|
|
|
|
|
$level = 1 if !defined $level; |
|
104
|
0
|
0
|
|
|
|
|
return if $level >= 5; # recursion breaker |
|
105
|
0
|
|
|
|
|
|
my @versions; |
|
106
|
1
|
|
|
1
|
|
341
|
no strict 'refs'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
797
|
|
|
107
|
0
|
0
|
|
|
|
|
if (defined ${$module . "::VERSION" }) { |
|
|
0
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
push @versions, [ $module => ${$module . "::VERSION" } ]; |
|
|
0
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
} |
|
110
|
0
|
0
|
|
|
|
|
if (!$no_recurse) { |
|
111
|
0
|
|
|
|
|
|
for my $sym (keys %{$module . "::"}) { |
|
|
0
|
|
|
|
|
|
|
|
112
|
0
|
0
|
|
|
|
|
if ($sym =~ /(.*)::$/) { |
|
113
|
0
|
|
|
|
|
|
$sym = $1; |
|
114
|
0
|
|
|
|
|
|
push @versions, $get_versions->($module . "::" . $sym, undef, $level+1); |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
} |
|
118
|
0
|
|
|
|
|
|
@versions; |
|
119
|
0
|
|
|
|
|
|
}; |
|
120
|
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
my $perlmod_versions = ""; |
|
122
|
0
|
|
|
|
|
|
my @perlmod_toplevel_modules = |
|
123
|
|
|
|
|
|
|
(qw(Apache CGI Template Data::JavaScript)); |
|
124
|
0
|
|
|
|
|
|
eval { |
|
125
|
0
|
|
|
|
|
|
my @perlmod_versions; |
|
126
|
0
|
|
|
|
|
|
for my $top (@perlmod_toplevel_modules) { |
|
127
|
0
|
|
|
|
|
|
push @perlmod_versions, $get_versions->($top, "norecurse"); |
|
128
|
|
|
|
|
|
|
} |
|
129
|
0
|
|
|
|
|
|
for my $v (sort { $a->[0] cmp $b->[0] } @perlmod_versions) { |
|
|
0
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
my($module, $version) = @$v; |
|
131
|
0
|
|
|
|
|
|
$perlmod_versions .= " $module $version\n"; |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
}; |
|
134
|
0
|
0
|
|
|
|
|
$perlmod_versions .= $@ if $@; |
|
135
|
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
my $we_versions = ""; |
|
137
|
0
|
|
|
|
|
|
my @toplevel_modules = |
|
138
|
|
|
|
|
|
|
(qw(WE WebEditor WE_Content WE_Frontend |
|
139
|
|
|
|
|
|
|
WE_Multisite WE_Sample WE_Singlesite)); |
|
140
|
0
|
|
|
|
|
|
push @toplevel_modules, "WE_" . $self->C->project->name; |
|
141
|
0
|
|
|
|
|
|
eval { |
|
142
|
0
|
|
|
|
|
|
my @we_versions; |
|
143
|
0
|
|
|
|
|
|
for my $top (@toplevel_modules) { |
|
144
|
0
|
|
|
|
|
|
push @we_versions, $get_versions->($top); |
|
145
|
|
|
|
|
|
|
} |
|
146
|
0
|
|
|
|
|
|
for my $v (sort { $a->[0] cmp $b->[0] } @we_versions) { |
|
|
0
|
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
|
my($module, $version) = @$v; |
|
148
|
0
|
|
|
|
|
|
$we_versions .= " $module $version\n"; |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
}; |
|
151
|
0
|
0
|
|
|
|
|
$we_versions .= $@ if $@; |
|
152
|
|
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
|
my $config_object; |
|
154
|
|
|
|
|
|
|
my $current_user; |
|
155
|
0
|
|
|
|
|
|
eval { |
|
156
|
0
|
|
|
|
|
|
require Data::Dumper; |
|
157
|
0
|
|
|
|
|
|
$config_object .= Data::Dumper::Dumper($self->C); |
|
158
|
0
|
|
|
|
|
|
$current_user = "Current user is `" . $self->User . "'.\n"; |
|
159
|
|
|
|
|
|
|
}; |
|
160
|
0
|
0
|
|
|
|
|
$config_object .= $@ if $@; |
|
161
|
|
|
|
|
|
|
|
|
162
|
0
|
|
|
|
|
|
my $database_status; |
|
163
|
0
|
|
|
|
|
|
eval { |
|
164
|
0
|
|
|
|
|
|
my $objdb = $self->Root->ObjDB; |
|
165
|
0
|
|
|
|
|
|
my $contentdb = $self->Root->ContentDB; |
|
166
|
0
|
|
|
|
|
|
$database_status = "The Object database has " . $objdb->count . " objects.\n"; |
|
167
|
|
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
|
require WE::Util::Support; |
|
169
|
0
|
|
|
|
|
|
require Data::Dumper; |
|
170
|
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
|
my $errors = $objdb->check_integrity($contentdb); |
|
172
|
0
|
|
|
|
|
|
my $contentdb_errors = $contentdb->check_integrity($objdb); |
|
173
|
|
|
|
|
|
|
|
|
174
|
0
|
|
|
|
|
|
$database_status .= "we_fsck returned:\n" . Data::Dumper::Dumper($errors, $contentdb_errors); |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
}; |
|
177
|
0
|
0
|
|
|
|
|
$database_status .= $@ if $@; |
|
178
|
|
|
|
|
|
|
|
|
179
|
0
|
|
|
|
|
|
my $template_config = ""; |
|
180
|
0
|
|
|
|
|
|
eval { |
|
181
|
0
|
|
|
|
|
|
require Data::Dumper; |
|
182
|
0
|
|
|
|
|
|
$template_config .= Data::Dumper::Dumper($self->TemplateConf); |
|
183
|
|
|
|
|
|
|
}; |
|
184
|
0
|
0
|
|
|
|
|
$template_config .= $@ if $@; |
|
185
|
|
|
|
|
|
|
|
|
186
|
0
|
|
|
|
|
|
my $template_vars = ""; |
|
187
|
0
|
|
|
|
|
|
eval { |
|
188
|
0
|
|
|
|
|
|
while(my($k,$v) = each %{ $self->TemplateVars }) { |
|
|
0
|
|
|
|
|
|
|
|
189
|
0
|
|
|
|
|
|
$template_vars .= "\t$k => $v,\n"; |
|
190
|
|
|
|
|
|
|
} |
|
191
|
|
|
|
|
|
|
}; |
|
192
|
0
|
0
|
|
|
|
|
$template_vars .= $@ if $@; |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
<
|
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
Unix system: |
|
198
|
|
|
|
|
|
|
$uname_a |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
EOF |
|
201
|
0
|
0
|
|
|
|
|
. ($linux_release ne "" ? <
|
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
$linux_release |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
EOF |
|
206
|
|
|
|
|
|
|
. <
|
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
Apache: |
|
209
|
|
|
|
|
|
|
$apache_version |
|
210
|
|
|
|
|
|
|
$operation_mode |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Perl version: |
|
214
|
|
|
|
|
|
|
$perl_version |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
Perl module versions: |
|
218
|
|
|
|
|
|
|
$perlmod_versions |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
WE versions: |
|
222
|
|
|
|
|
|
|
$we_versions |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
WebEditor config object: |
|
226
|
|
|
|
|
|
|
$config_object |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
Template-Toolkit config: |
|
230
|
|
|
|
|
|
|
$template_config |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
Template-Toolkit variables: |
|
234
|
|
|
|
|
|
|
$template_vars |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
$current_user |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
Database status: |
|
241
|
|
|
|
|
|
|
$database_status |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
EOF |
|
246
|
|
|
|
|
|
|
; |
|
247
|
|
|
|
|
|
|
} |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
1; |