Bug 9002 - Remove Problematic Logic from Patron Messaging Preferences Form
[koha.git] / about.pl
blob96a8b5a683c520c6e598fcd577c0e6c6e240d3d8
1 #!/usr/bin/perl
3 # Copyright Pat Eyler 2003
4 # Copyright Biblibre 2006
5 # Parts Copyright Liblime 2008
6 # Parts Copyright Chris Nighswonger 2010
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
13 # version.
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along
20 # with Koha; if not, write to the Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 use strict;
24 use warnings;
26 use CGI;
27 use LWP::Simple;
28 use XML::Simple;
29 use Config;
31 use C4::Output;
32 use C4::Auth;
33 use C4::Context;
34 use C4::Installer;
36 #use Smart::Comments '####';
38 my $query = new CGI;
39 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
41 template_name => "about.tmpl",
42 query => $query,
43 type => "intranet",
44 authnotrequired => 0,
45 flagsrequired => { catalogue => 1 },
46 debug => 1,
50 my $kohaVersion = C4::Context::KOHAVERSION;
51 my $osVersion = `uname -a`;
52 my $perl_path = $^X;
53 if ($^O ne 'VMS') {
54 $perl_path .= $Config{_exe} unless $perl_path =~ m/$Config{_exe}$/i;
56 my $perlVersion = $];
57 my $mysqlVersion = `mysql -V`;
58 my $apacheVersion = `httpd -v 2> /dev/null`;
59 $apacheVersion = `httpd2 -v 2> /dev/null` unless $apacheVersion;
60 $apacheVersion = (`/usr/sbin/apache2 -V`)[0] unless $apacheVersion;
61 my $zebraVersion = `zebraidx -V`;
63 # Additional system information for warnings
64 my $prefAutoCreateAuthorities = C4::Context->preference('AutoCreateAuthorities');
65 my $prefBiblioAddsAuthorities = C4::Context->preference('BiblioAddsAuthorities');
66 my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBiblioAddsAuthorities) );
68 my $prefEasyAnalyticalRecords = C4::Context->preference('EasyAnalyticalRecords');
69 my $prefUseControlNumber = C4::Context->preference('UseControlNumber');
70 my $warnPrefEasyAnalyticalRecords = ( $prefEasyAnalyticalRecords && $prefUseControlNumber );
72 my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode();
74 my $warnIsRootUser = (! $loggedinuser);
76 $template->param(
77 kohaVersion => $kohaVersion,
78 osVersion => $osVersion,
79 perlPath => $perl_path,
80 perlVersion => $perlVersion,
81 perlIncPath => [ map { perlinc => $_ }, @INC ],
82 mysqlVersion => $mysqlVersion,
83 apacheVersion => $apacheVersion,
84 zebraVersion => $zebraVersion,
85 prefBiblioAddsAuthorities => $prefBiblioAddsAuthorities,
86 prefAutoCreateAuthorities => $prefAutoCreateAuthorities,
87 warnPrefBiblioAddsAuthorities => $warnPrefBiblioAddsAuthorities,
88 warnPrefEasyAnalyticalRecords => $warnPrefEasyAnalyticalRecords,
89 errZebraConnection => $errZebraConnection,
90 warnIsRootUser => $warnIsRootUser,
93 my @components = ();
95 my $perl_modules = C4::Installer::PerlModules->new;
96 $perl_modules->version_info;
98 my @pm_types = qw(missing_pm upgrade_pm current_pm);
100 foreach my $pm_type(@pm_types) {
101 my $modules = $perl_modules->get_attr($pm_type);
102 foreach (@$modules) {
103 my ($module, $stats) = each %$_;
104 push(
105 @components,
107 name => $module,
108 version => $stats->{'cur_ver'},
109 missing => ($pm_type eq 'missing_pm' ? 1 : 0),
110 upgrade => ($pm_type eq 'upgrade_pm' ? 1 : 0),
111 current => ($pm_type eq 'current_pm' ? 1 : 0),
112 require => $stats->{'required'},
118 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
120 my $counter=0;
121 my $row = [];
122 my $table = [];
123 foreach (@components) {
124 push (@$row, $_);
125 unless (++$counter % 4) {
126 push (@$table, {row => $row});
127 $row = [];
130 # Processing the last line (if there are any modules left)
131 if (scalar(@$row) > 0) {
132 # Extending $row to the table size
133 $$row[3] = '';
134 # Pushing the last line
135 push (@$table, {row => $row});
137 ## ## $table
139 $template->param( table => $table );
142 ## ------------------------------------------
143 ## Koha time line code
145 #get file location
146 my $dir = C4::Context->config('intranetdir');
147 open( my $file, "<", "$dir" . "/docs/history.txt" );
148 my $i = 0;
150 my @rows2 = ();
151 my $row2 = [];
153 my @lines = <$file>;
154 close($file);
156 shift @lines; #remove header row
158 foreach (@lines) {
159 my ( $date, $desc, $tag ) = split(/\t/);
160 if(!$desc && $date=~ /(?<=\d{4})\s+/) {
161 ($date, $desc)= ($`, $');
163 push(
164 @rows2,
166 date => $date,
167 desc => $desc,
172 my $table2 = [];
173 #foreach my $row2 (@rows2) {
174 foreach (@rows2) {
175 push (@$row2, $_);
176 push( @$table2, { row2 => $row2 } );
177 $row2 = [];
180 $template->param( table2 => $table2 );
182 output_html_with_http_headers $query, $cookie, $template->output;