improvement: on the About page, a caption was added to the table of Perl
[wip/koha-chris_n.git] / about.pl
1 #!/usr/bin/perl
2 use HTML::Template;
3 use strict;
4 require Exporter;
5 use C4::Database;
6 use C4::Output;  # contains gettemplate
7 use C4::Interface::CGI::Output;
8 use C4::Auth;
9 use C4::Context;
10 use CGI;
11 use LWP::Simple;
12 use XML::Simple;
13
14 my $query = new CGI;
15 my ($template, $loggedinuser, $cookie)
16     = get_template_and_user({template_name => "about.tmpl",
17                              query => $query,
18                              type => "intranet",
19                              authnotrequired => 0,
20                              flagsrequired => {parameters => 1},
21                              debug => 1,
22                              });
23
24 my $kohaVersion = C4::Context->config("kohaversion");
25 my $osVersion = `uname -a`;
26 my $perlVersion = $];
27 my $mysqlVersion = `mysql -V`;
28 my $apacheVersion =  `httpd -v`;
29 $apacheVersion =  `httpd2 -v` unless $apacheVersion;
30 my $zebraVersion = `zebraidx -V`;
31
32 $template->param(
33                                         kohaVersion => $kohaVersion,
34                                         osVersion          => $osVersion,
35                                         perlVersion        => $perlVersion,
36                                         mysqlVersion       => $mysqlVersion,
37                                         apacheVersion      => $apacheVersion,
38                                         zebraVersion       => $zebraVersion,
39                 );
40
41 my @component_names =
42     qw/MARC::File::XML   MARC::Charset     Class::Accessor
43        LWP::Simple       XML::Simple       Net::Z3950
44        Event             Net::LDAP         PDF::API2
45        Mail::Sendmail    MARC::Record      Digest::MD5
46        HTML::Template    DBD::mysql        Date::Manip
47        DBI               Smart::Comments   ZOOM
48       /;
49 my @components = ();
50
51 foreach my $component (sort @component_names) {
52     my $version;
53     if (eval "require $component") {
54         $version = $component->VERSION;
55         if ($version eq '' ) {
56             $version = 'unknown';
57         }
58     }
59     else {
60         $version = 'module is missing';
61     }
62
63     push (
64         @components,
65         {
66             name    => $component,
67             version => $version,
68         }
69     );
70 }
71
72 $template->param(
73     components => \@components
74 );
75
76 output_html_with_http_headers $query, $cookie, $template->output;