Resolution for issues raised in Bug 2076:
[koha.git] / about.pl
1 #!/usr/bin/perl
2  
3 # This file is part of Koha.
4 #
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
8 # version.
9 #
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA  02111-1307 USA
17
18 use strict;
19 require Exporter;
20
21 use C4::Output;    # contains gettemplate
22 use C4::Auth;
23 use C4::Context;
24 use CGI;
25 use LWP::Simple;
26 use XML::Simple;
27 use Config;
28
29 my $query = new CGI;
30 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
31     {
32         template_name   => "about.tmpl",
33         query           => $query,
34         type            => "intranet",
35         authnotrequired => 0,
36         flagsrequired   => { catalogue => 1 },
37         debug           => 1,
38     }
39 );
40
41 my $kohaVersion   = C4::Context::KOHAVERSION;
42 my $osVersion     = `uname -a`;
43 my $perl_path = $^X;
44 if ($^O ne 'VMS') {
45     $perl_path .= $Config{_exe} unless $perl_path =~ m/$Config{_exe}$/i;
46 }
47 my $perlVersion   = $];
48 my $mysqlVersion  = `mysql -V`;
49 my $apacheVersion = `httpd -v`;
50 $apacheVersion = `httpd2 -v` unless $apacheVersion;
51 $apacheVersion = (`/usr/sbin/apache2 -V`)[0] unless $apacheVersion;
52 my $zebraVersion = `zebraidx -V`;
53
54 $template->param(
55     kohaVersion   => $kohaVersion,
56     osVersion     => $osVersion,
57     perlPath      => $perl_path,
58     perlVersion   => $perlVersion,
59     perlIncPath   => [ map { perlinc => $_ }, @INC ],
60     mysqlVersion  => $mysqlVersion,
61     apacheVersion => $apacheVersion,
62     zebraVersion  => $zebraVersion,
63 );
64 my @component_names =
65     qw/
66 Biblio::EndnoteStyle
67 CGI
68 CGI::Carp
69 CGI::Session
70 Class::Factory::Util
71 Class::Accessor
72 Compress::Zlib
73 DBD::mysql
74 DBI
75 Data::Ical
76 Data::Dumper
77 Date::Calc
78 Date::Ical
79 Date::Manip
80 Digest::MD5
81 File::Temp
82 GD::Barcode::UPCE
83 Getopt::Long
84 Getopt::Std
85 HTML::Template::Pro
86 HTTP::Cookies
87 HTTP::Request::Common
88 HTML::Scrubber
89 Image::Magick
90 LWP::Simple
91 LWP::UserAgent
92 Lingua::Stem
93 List::Util
94 List::MoreUtils
95 Locale::Language
96 MARC::Crosswalk::DublinCore
97 MARC::Charset
98 MARC::File::XML
99 MARC::Record
100 MIME::Base64
101 MIME::QuotedPrint
102 Mail::Sendmail
103 Net::LDAP
104 Net::LDAP::Filter
105 Net::Z3950::ZOOM
106 PDF::API2
107 PDF::API2::Page
108 PDF::API2::Util
109 PDF::Reuse
110 PDF::Reuse::Barcode
111 POE
112 POSIX
113 Schedule::At
114 Term::ANSIColor
115 Test
116 Test::Harness
117 Test::More
118 Text::CSV
119 Text::CSV_XS
120 Text::Iconv
121 Text::Wrap
122 Time::HiRes
123 Time::localtime
124 Unicode::Normalize
125 XML::Dumper
126 XML::LibXML
127 XML::LibXSLT
128 XML::SAX::ParserFactory
129 XML::Simple
130 XML::RSS
131 YAML::Syck
132       /;
133
134 my @components = ();
135
136 my $counter=0;
137 foreach my $component ( sort @component_names ) {
138     my $version;
139     if ( eval "require $component" ) {
140         $version = $component->VERSION;
141         if ( $version eq '' ) {
142             $version = 'unknown';
143         }
144     }
145     else {
146         $version = 'module is missing';
147     }
148     $counter++;
149     $counter=0 if $counter >3;
150     push(
151         @components,
152         {
153             name    => $component,
154             version => $version,
155             counter => $counter,
156         }
157     );
158 }
159
160 $template->param( components => \@components );
161
162 output_html_with_http_headers $query, $cookie, $template->output;