Merge remote branch 'kc/new/bug_5236' into kcmaster
[koha.git] / about.pl
blobbe5e0ab35d77167281f121a418e89e8ddbcafd0e
1 #!/usr/bin/perl
3 # This file is part of Koha.
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.
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.
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
18 use strict;
19 use warnings;
21 use CGI;
22 use LWP::Simple;
23 use XML::Simple;
24 use Config;
26 use C4::Output; # contains gettemplate
27 use C4::Auth;
28 use C4::Context;
29 use C4::Installer;
31 my $query = new CGI;
32 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
34 template_name => "about.tmpl",
35 query => $query,
36 type => "intranet",
37 authnotrequired => 0,
38 flagsrequired => { catalogue => 1 },
39 debug => 1,
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;
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`;
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,
67 my @components = ();
69 my $perl_modules = C4::Installer::PerlModules->new;
70 $perl_modules->version_info;
72 my @pm_types = qw(missing_pm upgrade_pm current_pm);
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,
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'},
92 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
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 = [];
105 $template->param( table => $table );
107 output_html_with_http_headers $query, $cookie, $template->output;