Bug 12862: OPAC bootstrap - clean up language="javascript"
[koha.git] / about.pl
blobd144e371bb3465a1600ef7aaa20fdde39f04ab48
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.tt",
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 );
71 my $warnPrefAnonymousPatron = (
72 C4::Context->preference('OPACPrivacy')
73 and not C4::Context->preference('AnonymousPatron')
76 my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode();
78 my $warnIsRootUser = (! $loggedinuser);
80 my $warnNoActiveCurrency = (! defined C4::Budgets->GetCurrency());
81 my @xml_config_warnings;
83 if ( ! defined C4::Context->config('zebra_bib_index_mode') ) {
84 push @xml_config_warnings, {
85 error => 'zebra_bib_index_mode_warn'
89 if ( ! defined C4::Context->config('zebra_auth_index_mode') ) {
90 push @xml_config_warnings, {
91 error => 'zebra_auth_index_mode_warn'
95 # Test QueryParser configuration sanity
96 if ( C4::Context->preference( 'UseQueryParser' ) ) {
97 # Get the QueryParser configuration file name
98 my $queryparser_file = C4::Context->config( 'queryparser_config' );
99 my $queryparser_fallback_file = '/etc/koha/searchengine/queryparser.yaml';
100 # Check QueryParser is functional
101 my $QParser = C4::Context->queryparser();
102 my $queryparser_error = {};
103 if ( ! defined $QParser || ref($QParser) ne 'Koha::QueryParser::Driver::PQF' ) {
104 # Error initializing the QueryParser object
105 # Get the used queryparser.yaml file path to report the user
106 $queryparser_error->{ fallback } = ( defined $queryparser_file ) ? 0 : 1;
107 $queryparser_error->{ file } = ( defined $queryparser_file )
108 ? $queryparser_file
109 : $queryparser_fallback_file;
110 # Report error data to the template
111 $template->param( QueryParserError => $queryparser_error );
112 } else {
113 # Check for an absent queryparser_config entry in koha-conf.xml
114 if ( ! defined $queryparser_file ) {
115 # Not an error but a warning for the missing entry in koha-conf-xml
116 push @xml_config_warnings, {
117 error => 'queryparser_entry_missing',
118 file => $queryparser_fallback_file
124 $template->param(
125 kohaVersion => $kohaVersion,
126 osVersion => $osVersion,
127 perlPath => $perl_path,
128 perlVersion => $perlVersion,
129 perlIncPath => [ map { perlinc => $_ }, @INC ],
130 mysqlVersion => $mysqlVersion,
131 apacheVersion => $apacheVersion,
132 zebraVersion => $zebraVersion,
133 prefBiblioAddsAuthorities => $prefBiblioAddsAuthorities,
134 prefAutoCreateAuthorities => $prefAutoCreateAuthorities,
135 warnPrefBiblioAddsAuthorities => $warnPrefBiblioAddsAuthorities,
136 warnPrefEasyAnalyticalRecords => $warnPrefEasyAnalyticalRecords,
137 warnPrefAnonymousPatron => $warnPrefAnonymousPatron,
138 errZebraConnection => $errZebraConnection,
139 warnIsRootUser => $warnIsRootUser,
140 warnNoActiveCurrency => $warnNoActiveCurrency,
141 xml_config_warnings => \@xml_config_warnings,
144 my @components = ();
146 my $perl_modules = C4::Installer::PerlModules->new;
147 $perl_modules->version_info;
149 my @pm_types = qw(missing_pm upgrade_pm current_pm);
151 foreach my $pm_type(@pm_types) {
152 my $modules = $perl_modules->get_attr($pm_type);
153 foreach (@$modules) {
154 my ($module, $stats) = each %$_;
155 push(
156 @components,
158 name => $module,
159 version => $stats->{'cur_ver'},
160 missing => ($pm_type eq 'missing_pm' ? 1 : 0),
161 upgrade => ($pm_type eq 'upgrade_pm' ? 1 : 0),
162 current => ($pm_type eq 'current_pm' ? 1 : 0),
163 require => $stats->{'required'},
164 reqversion => $stats->{'min_ver'},
170 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
172 my $counter=0;
173 my $row = [];
174 my $table = [];
175 foreach (@components) {
176 push (@$row, $_);
177 unless (++$counter % 4) {
178 push (@$table, {row => $row});
179 $row = [];
182 # Processing the last line (if there are any modules left)
183 if (scalar(@$row) > 0) {
184 # Extending $row to the table size
185 $$row[3] = '';
186 # Pushing the last line
187 push (@$table, {row => $row});
189 ## ## $table
191 $template->param( table => $table );
194 ## ------------------------------------------
195 ## Koha time line code
197 #get file location
198 my $docdir;
199 if ( defined C4::Context->config('docdir') ) {
200 $docdir = C4::Context->config('docdir');
201 } else {
202 # if no <docdir> is defined in koha-conf.xml, use the default location
203 # this is a work-around to stop breakage on upgraded Kohas, bug 8911
204 $docdir = C4::Context->config('intranetdir') . '/docs';
207 if ( open( my $file, "<", "$docdir" . "/history.txt" ) ) {
209 my $i = 0;
211 my @rows2 = ();
212 my $row2 = [];
214 my @lines = <$file>;
215 close($file);
217 shift @lines; #remove header row
219 foreach (@lines) {
220 my ( $date, $desc, $tag ) = split(/\t/);
221 if(!$desc && $date=~ /(?<=\d{4})\s+/) {
222 ($date, $desc)= ($`, $');
224 push(
225 @rows2,
227 date => $date,
228 desc => $desc,
233 my $table2 = [];
234 #foreach my $row2 (@rows2) {
235 foreach (@rows2) {
236 push (@$row2, $_);
237 push( @$table2, { row2 => $row2 } );
238 $row2 = [];
241 $template->param( table2 => $table2 );
242 } else {
243 $template->param( timeline_read_error => 1 );
246 output_html_with_http_headers $query, $cookie, $template->output;