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
11 # under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 3 of the License, or
13 # (at your option) any later version.
15 # Koha is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with Koha; if not, see <http://www.gnu.org/licenses>.
26 use List::MoreUtils qw/ any /;
37 use Koha::Acquisition::Currencies;
39 use Koha::Config::SysPrefs;
40 use C4::Members::Statistics;
42 #use Smart::Comments '####';
45 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
47 template_name => "about.tt",
51 flagsrequired => { catalogue => 1 },
58 $perl_path .= $Config{_exe} unless $perl_path =~ m/$Config{_exe}$/i;
61 my $zebraVersion = `zebraidx -V`;
63 # Check running PSGI env
64 if ( any { /(^psgi\.|^plack\.)/i } keys %ENV ) {
67 psgi_server => ($ENV{ PLACK_ENV }) ? "Plack ($ENV{PLACK_ENV})" :
68 ($ENV{ MOD_PERL }) ? "mod_perl ($ENV{MOD_PERL})" :
73 # Memcached configuration
75 my $memcached_servers = $ENV{ MEMCACHED_SERVERS };
76 my $memcached_namespace = $ENV{ MEMCACHED_NAMESPACE };
77 my $memcached_running = C4::Context->ismemcached;
80 memcached_servers => $ENV{ MEMCACHED_SERVERS },
81 memcached_namespace => $ENV{ MEMCACHED_NAMESPACE },
82 memcached_running => C4::Context->ismemcached
85 # Additional system information for warnings
87 my $warnStatisticsFieldsError;
88 my $prefStatisticsFields = C4::Context->preference('StatisticsFields');
89 if ($prefStatisticsFields) {
90 $warnStatisticsFieldsError = $prefStatisticsFields
91 unless ( $prefStatisticsFields eq C4::Members::Statistics->get_fields() );
94 my $prefAutoCreateAuthorities = C4::Context->preference('AutoCreateAuthorities');
95 my $prefBiblioAddsAuthorities = C4::Context->preference('BiblioAddsAuthorities');
96 my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBiblioAddsAuthorities) );
98 my $prefEasyAnalyticalRecords = C4::Context->preference('EasyAnalyticalRecords');
99 my $prefUseControlNumber = C4::Context->preference('UseControlNumber');
100 my $warnPrefEasyAnalyticalRecords = ( $prefEasyAnalyticalRecords && $prefUseControlNumber );
101 my $warnPrefAnonymousPatron = (
102 C4::Context->preference('OPACPrivacy')
103 and not C4::Context->preference('AnonymousPatron')
106 my $anonymous_patron = Koha::Patrons->find( C4::Context->preference('AnonymousPatron') );
107 my $warnPrefAnonymousPatron_PatronDoesNotExist = ( not $anonymous_patron and Koha::Patrons->search({ privacy => 2 })->count );
109 my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode();
111 my $warnIsRootUser = (! $loggedinuser);
113 my $warnNoActiveCurrency = (! defined Koha::Acquisition::Currencies->get_active);
114 my @xml_config_warnings;
116 my $context = new C4::Context;
118 if ( ! defined C4::Context->config('zebra_bib_index_mode') ) {
119 push @xml_config_warnings, {
120 error => 'zebra_bib_index_mode_warn'
122 if ($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) {
123 push @xml_config_warnings, {
124 error => 'zebra_bib_mode_seems_grs1'
128 push @xml_config_warnings, {
129 error => 'zebra_bib_mode_seems_dom'
133 push @xml_config_warnings, { error => 'zebra_bib_grs_warn' }
134 if C4::Context->config('zebra_bib_index_mode') eq 'grs1';
137 if ( (C4::Context->config('zebra_bib_index_mode') eq 'dom') &&
138 ($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) ) {
140 push @xml_config_warnings, {
141 error => 'zebra_bib_index_mode_mismatch_warn'
145 if ( (C4::Context->config('zebra_bib_index_mode') eq 'grs1') &&
146 ($context->{'server'}->{'biblioserver'}->{'config'} =~ /zebra-biblios-dom.cfg/) ) {
148 push @xml_config_warnings, {
149 error => 'zebra_bib_index_mode_mismatch_warn'
153 if ( ! defined C4::Context->config('zebra_auth_index_mode') ) {
154 push @xml_config_warnings, {
155 error => 'zebra_auth_index_mode_warn'
157 if ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) {
158 push @xml_config_warnings, {
159 error => 'zebra_auth_mode_seems_grs1'
163 push @xml_config_warnings, {
164 error => 'zebra_auth_mode_seems_dom'
168 push @xml_config_warnings, { error => 'zebra_auth_grs_warn' }
169 if C4::Context->config('zebra_auth_index_mode') eq 'grs1';
172 if ( (C4::Context->config('zebra_auth_index_mode') eq 'dom') && ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) ) {
173 push @xml_config_warnings, {
174 error => 'zebra_auth_index_mode_mismatch_warn'
178 if ( (C4::Context->config('zebra_auth_index_mode') eq 'grs1') && ($context->{'server'}->{'authorityserver'}->{'config'} =~ /zebra-authorities-dom.cfg/) ) {
179 push @xml_config_warnings, {
180 error => 'zebra_auth_index_mode_mismatch_warn'
184 if ( ! defined C4::Context->config('log4perl_conf') ) {
185 push @xml_config_warnings, {
186 error => 'log4perl_entry_missing'
190 if ( ! defined C4::Context->config('upload_path') ) {
191 if ( Koha::Config::SysPrefs->find('OPACBaseURL')->value ) {
192 # OPACBaseURL seems to be set
193 push @xml_config_warnings, {
194 error => 'uploadpath_entry_missing'
197 push @xml_config_warnings, {
198 error => 'uploadpath_and_opacbaseurl_entry_missing'
203 # Test QueryParser configuration sanity
204 if ( C4::Context->preference( 'UseQueryParser' ) ) {
205 # Get the QueryParser configuration file name
206 my $queryparser_file = C4::Context->config( 'queryparser_config' );
207 my $queryparser_fallback_file = '/etc/koha/searchengine/queryparser.yaml';
208 # Check QueryParser is functional
209 my $QParser = C4::Context->queryparser();
210 my $queryparser_error = {};
211 if ( ! defined $QParser || ref($QParser) ne 'Koha::QueryParser::Driver::PQF' ) {
212 # Error initializing the QueryParser object
213 # Get the used queryparser.yaml file path to report the user
214 $queryparser_error->{ fallback } = ( defined $queryparser_file ) ? 0 : 1;
215 $queryparser_error->{ file } = ( defined $queryparser_file )
217 : $queryparser_fallback_file;
218 # Report error data to the template
219 $template->param( QueryParserError => $queryparser_error );
221 # Check for an absent queryparser_config entry in koha-conf.xml
222 if ( ! defined $queryparser_file ) {
223 # Not an error but a warning for the missing entry in koha-conf-xml
224 push @xml_config_warnings, {
225 error => 'queryparser_entry_missing',
226 file => $queryparser_fallback_file
232 # Test Zebra facets configuration
233 if ( !defined C4::Context->config('use_zebra_facets') ) {
234 push @xml_config_warnings, { error => 'use_zebra_facets_entry_missing' };
236 if ( C4::Context->config('use_zebra_facets') &&
237 C4::Context->config('zebra_bib_index_mode') ) {
238 # use_zebra_facets works with DOM
239 push @xml_config_warnings, {
240 error => 'use_zebra_facets_needs_dom'
241 } if C4::Context->config('zebra_bib_index_mode') ne 'dom' ;
245 # Sco Patron should not contain any other perms than circulate => self_checkout
246 if ( C4::Context->preference('WebBasedSelfCheck')
247 and C4::Context->preference('AutoSelfCheckAllowed')
249 my $userid = C4::Context->preference('AutoSelfCheckID');
250 my $all_permissions = C4::Auth::get_user_subpermissions( $userid );
251 my ( $has_self_checkout_perm, $has_other_permissions );
252 while ( my ( $module, $permissions ) = each %$all_permissions ) {
253 if ( $module eq 'circulate' ) {
254 while ( my ( $permission, $flag ) = each %$permissions ) {
255 if ( $permission eq 'self_checkout' ) {
256 $has_self_checkout_perm = 1;
258 $has_other_permissions = 1;
262 $has_other_permissions = 1;
266 AutoSelfCheckPatronDoesNotHaveSelfCheckPerm => not ( $has_self_checkout_perm ),
267 AutoSelfCheckPatronHasTooManyPerm => $has_other_permissions,
273 my %versions = C4::Context::get_versions();
276 kohaVersion => $versions{'kohaVersion'},
277 osVersion => $versions{'osVersion'},
278 perlPath => $perl_path,
279 perlVersion => $versions{'perlVersion'},
280 perlIncPath => [ map { perlinc => $_ }, @INC ],
281 mysqlVersion => $versions{'mysqlVersion'},
282 apacheVersion => $versions{'apacheVersion'},
283 zebraVersion => $zebraVersion,
284 prefBiblioAddsAuthorities => $prefBiblioAddsAuthorities,
285 prefAutoCreateAuthorities => $prefAutoCreateAuthorities,
286 warnPrefBiblioAddsAuthorities => $warnPrefBiblioAddsAuthorities,
287 warnPrefEasyAnalyticalRecords => $warnPrefEasyAnalyticalRecords,
288 warnPrefAnonymousPatron => $warnPrefAnonymousPatron,
289 warnPrefAnonymousPatron_PatronDoesNotExist => $warnPrefAnonymousPatron_PatronDoesNotExist,
290 errZebraConnection => $errZebraConnection,
291 warnIsRootUser => $warnIsRootUser,
292 warnNoActiveCurrency => $warnNoActiveCurrency,
293 xml_config_warnings => \@xml_config_warnings,
294 warnStatisticsFieldsError => $warnStatisticsFieldsError,
299 my $perl_modules = C4::Installer::PerlModules->new;
300 $perl_modules->version_info;
302 my @pm_types = qw(missing_pm upgrade_pm current_pm);
304 foreach my $pm_type(@pm_types) {
305 my $modules = $perl_modules->get_attr($pm_type);
306 foreach (@$modules) {
307 my ($module, $stats) = each %$_;
312 version => $stats->{'cur_ver'},
313 missing => ($pm_type eq 'missing_pm' ? 1 : 0),
314 upgrade => ($pm_type eq 'upgrade_pm' ? 1 : 0),
315 current => ($pm_type eq 'current_pm' ? 1 : 0),
316 require => $stats->{'required'},
317 reqversion => $stats->{'min_ver'},
323 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
328 foreach (@components) {
330 unless (++$counter % 4) {
331 push (@$table, {row => $row});
335 # Processing the last line (if there are any modules left)
336 if (scalar(@$row) > 0) {
337 # Extending $row to the table size
339 # Pushing the last line
340 push (@$table, {row => $row});
344 $template->param( table => $table );
347 ## ------------------------------------------
348 ## Koha time line code
352 if ( defined C4::Context->config('docdir') ) {
353 $docdir = C4::Context->config('docdir');
355 # if no <docdir> is defined in koha-conf.xml, use the default location
356 # this is a work-around to stop breakage on upgraded Kohas, bug 8911
357 $docdir = C4::Context->config('intranetdir') . '/docs';
360 if ( open( my $file, "<:encoding(UTF-8)", "$docdir" . "/history.txt" ) ) {
370 shift @lines; #remove header row
373 my ( $date, $desc, $tag ) = split(/\t/);
374 if(!$desc && $date=~ /(?<=\d{4})\s+/) {
375 ($date, $desc)= ($`, $');
387 #foreach my $row2 (@rows2) {
390 push( @$table2, { row2 => $row2 } );
394 $template->param( table2 => $table2 );
396 $template->param( timeline_read_error => 1 );
399 output_html_with_http_headers $query, $cookie, $template->output;