updated to installation instructions
[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 use warnings;
20
21 use CGI;
22 use LWP::Simple;
23 use XML::Simple;
24 use Config;
25
26 use C4::Output;    # contains gettemplate
27 use C4::Auth;
28 use C4::Context;
29 use C4::Installer;
30
31 my $query = new CGI;
32 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
33     {
34         template_name   => "about.tmpl",
35         query           => $query,
36         type            => "intranet",
37         authnotrequired => 0,
38         flagsrequired   => { catalogue => 1 },
39         debug           => 1,
40     }
41 );
42
43 my $kohaVersion   = C4::Context::KOHAVERSION;
44 my $osVersion     = `uname -a`;
45 my $perl_path = $^X;
46 if ($^O ne 'VMS') {
47     $perl_path .= $Config{_exe} unless $perl_path =~ m/$Config{_exe}$/i;
48 }
49 my $perlVersion   = $];
50 my $mysqlVersion  = `mysql -V`;
51 my $apacheVersion = `httpd -v`;
52 $apacheVersion = `httpd2 -v` unless $apacheVersion;
53 $apacheVersion = (`/usr/sbin/apache2 -V`)[0] unless $apacheVersion;
54 my $zebraVersion = `zebraidx -V`;
55
56 $template->param(
57     kohaVersion   => $kohaVersion,
58     osVersion     => $osVersion,
59     perlPath      => $perl_path,
60     perlVersion   => $perlVersion,
61     perlIncPath   => [ map { perlinc => $_ }, @INC ],
62     mysqlVersion  => $mysqlVersion,
63     apacheVersion => $apacheVersion,
64     zebraVersion  => $zebraVersion,
65 );
66
67 my @components = ();
68
69 my $perl_modules = C4::Installer::PerlModules->new;
70 $perl_modules->version_info;
71
72 my @pm_types = qw(missing_pm upgrade_pm current_pm);
73
74 foreach my $pm_type(@pm_types) {
75     my $modules = $perl_modules->get_attr($pm_type);
76     foreach (@$modules) {
77         my ($module, $stats) = each %$_;
78         push(
79             @components,
80             {
81                 name    => $module,
82                 version => $stats->{'cur_ver'},
83                 missing => ($pm_type eq 'missing_pm' ? 1 : 0),
84                 upgrade => ($pm_type eq 'upgrade_pm' ? 1 : 0),
85                 current => ($pm_type eq 'current_pm' ? 1 : 0),
86                 require => $stats->{'required'},
87             }
88         );
89     }
90 }
91
92 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
93
94 my $counter=0;
95 my $row = [];
96 my $table = [];
97 foreach (@components) {
98     push (@$row, $_);
99     unless (++$counter % 4) {
100         push (@$table, {row => $row});
101         $row = [];
102     }
103 }
104
105 $template->param( table => $table );
106
107 output_html_with_http_headers $query, $cookie, $template->output;