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
;
38 use Koha
::Patron
::Categories
;
41 use Koha
::Config
::SysPrefs
;
42 use Koha
::Illrequest
::Config
;
43 use C4
::Members
::Statistics
;
45 #use Smart::Comments '####';
48 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
50 template_name
=> "about.tt",
54 flagsrequired
=> { catalogue
=> 1 },
61 $perl_path .= $Config{_exe
} unless $perl_path =~ m/$Config{_exe}$/i;
64 my $zebraVersion = `zebraidx -V`;
66 # Check running PSGI env
67 if ( any
{ /(^psgi\.|^plack\.)/i } keys %ENV ) {
70 psgi_server
=> ($ENV{ PLACK_ENV
}) ?
"Plack ($ENV{PLACK_ENV})" :
71 ($ENV{ MOD_PERL
}) ?
"mod_perl ($ENV{MOD_PERL})" :
76 # Memcached configuration
77 my $memcached_servers = $ENV{MEMCACHED_SERVERS
} || C4
::Context
->config('memcached_servers');
78 my $memcached_namespace = $ENV{MEMCACHED_NAMESPACE
} || C4
::Context
->config('memcached_namespace') // 'koha';
80 my $cache = Koha
::Caches
->get_instance;
81 my $effective_caching_method = ref($cache->cache);
82 # Memcached may have been running when plack has been initialized but could have been stopped since
83 # FIXME What are the consequences of that??
84 my $is_memcached_still_active = $cache->set_in_cache('test_for_about_page', "just a simple value");
86 my $where_is_memcached_config = 'nowhere';
87 if ( $ENV{MEMCACHED_SERVERS
} and C4
::Context
->config('memcached_servers') ) {
88 $where_is_memcached_config = 'both';
89 } elsif ( $ENV{MEMCACHED_SERVERS
} and not C4
::Context
->config('memcached_servers') ) {
90 $where_is_memcached_config = 'ENV_only';
91 } elsif ( C4
::Context
->config('memcached_servers') ) {
92 $where_is_memcached_config = 'config_only';
96 effective_caching_method
=> $effective_caching_method,
97 memcached_servers
=> $memcached_servers,
98 memcached_namespace
=> $memcached_namespace,
99 is_memcached_still_active
=> $is_memcached_still_active,
100 where_is_memcached_config
=> $where_is_memcached_config,
101 memcached_running
=> Koha
::Caches
->get_instance->memcached_cache,
104 # Additional system information for warnings
106 my $warnStatisticsFieldsError;
107 my $prefStatisticsFields = C4
::Context
->preference('StatisticsFields');
108 if ($prefStatisticsFields) {
109 $warnStatisticsFieldsError = $prefStatisticsFields
110 unless ( $prefStatisticsFields eq C4
::Members
::Statistics
->get_fields() );
113 my $prefAutoCreateAuthorities = C4
::Context
->preference('AutoCreateAuthorities');
114 my $prefBiblioAddsAuthorities = C4
::Context
->preference('BiblioAddsAuthorities');
115 my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBiblioAddsAuthorities) );
117 my $prefEasyAnalyticalRecords = C4
::Context
->preference('EasyAnalyticalRecords');
118 my $prefUseControlNumber = C4
::Context
->preference('UseControlNumber');
119 my $warnPrefEasyAnalyticalRecords = ( $prefEasyAnalyticalRecords && $prefUseControlNumber );
120 my $warnPrefAnonymousPatron = (
121 C4
::Context
->preference('OPACPrivacy')
122 and not C4
::Context
->preference('AnonymousPatron')
125 my $anonymous_patron = Koha
::Patrons
->find( C4
::Context
->preference('AnonymousPatron') );
126 my $warnPrefAnonymousPatron_PatronDoesNotExist = ( not $anonymous_patron and Koha
::Patrons
->search({ privacy
=> 2 })->count );
128 my $errZebraConnection = C4
::Context
->Zconn("biblioserver",0)->errcode();
130 my $warnIsRootUser = (! $loggedinuser);
132 my $warnNoActiveCurrency = (! defined Koha
::Acquisition
::Currencies
->get_active);
134 my @xml_config_warnings;
136 my $context = new C4
::Context
;
138 if ( ! defined C4
::Context
->config('zebra_bib_index_mode') ) {
139 push @xml_config_warnings, {
140 error
=> 'zebra_bib_index_mode_warn'
142 if ($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) {
143 push @xml_config_warnings, {
144 error
=> 'zebra_bib_mode_seems_grs1'
148 push @xml_config_warnings, {
149 error
=> 'zebra_bib_mode_seems_dom'
153 push @xml_config_warnings, { error
=> 'zebra_bib_grs_warn' }
154 if C4
::Context
->config('zebra_bib_index_mode') eq 'grs1';
157 if ( (C4
::Context
->config('zebra_bib_index_mode') eq 'dom') &&
158 ($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) ) {
160 push @xml_config_warnings, {
161 error
=> 'zebra_bib_index_mode_mismatch_warn'
165 if ( (C4
::Context
->config('zebra_bib_index_mode') eq 'grs1') &&
166 ($context->{'server'}->{'biblioserver'}->{'config'} =~ /zebra-biblios-dom.cfg/) ) {
168 push @xml_config_warnings, {
169 error
=> 'zebra_bib_index_mode_mismatch_warn'
173 if ( ! defined C4
::Context
->config('zebra_auth_index_mode') ) {
174 push @xml_config_warnings, {
175 error
=> 'zebra_auth_index_mode_warn'
177 if ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) {
178 push @xml_config_warnings, {
179 error
=> 'zebra_auth_mode_seems_grs1'
183 push @xml_config_warnings, {
184 error
=> 'zebra_auth_mode_seems_dom'
188 push @xml_config_warnings, { error
=> 'zebra_auth_grs_warn' }
189 if C4
::Context
->config('zebra_auth_index_mode') eq 'grs1';
192 if ( (C4
::Context
->config('zebra_auth_index_mode') eq 'dom') && ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) ) {
193 push @xml_config_warnings, {
194 error
=> 'zebra_auth_index_mode_mismatch_warn'
198 if ( (C4
::Context
->config('zebra_auth_index_mode') eq 'grs1') && ($context->{'server'}->{'authorityserver'}->{'config'} =~ /zebra-authorities-dom.cfg/) ) {
199 push @xml_config_warnings, {
200 error
=> 'zebra_auth_index_mode_mismatch_warn'
204 if ( ! defined C4
::Context
->config('log4perl_conf') ) {
205 push @xml_config_warnings, {
206 error
=> 'log4perl_entry_missing'
210 if ( ! defined C4
::Context
->config('upload_path') ) {
211 if ( Koha
::Config
::SysPrefs
->find('OPACBaseURL')->value ) {
212 # OPACBaseURL seems to be set
213 push @xml_config_warnings, {
214 error
=> 'uploadpath_entry_missing'
217 push @xml_config_warnings, {
218 error
=> 'uploadpath_and_opacbaseurl_entry_missing'
223 # Test QueryParser configuration sanity
224 if ( C4
::Context
->preference( 'UseQueryParser' ) ) {
225 # Get the QueryParser configuration file name
226 my $queryparser_file = C4
::Context
->config( 'queryparser_config' );
227 my $queryparser_fallback_file = '/etc/koha/searchengine/queryparser.yaml';
228 # Check QueryParser is functional
229 my $QParser = C4
::Context
->queryparser();
230 my $queryparser_error = {};
231 if ( ! defined $QParser || ref($QParser) ne 'Koha::QueryParser::Driver::PQF' ) {
232 # Error initializing the QueryParser object
233 # Get the used queryparser.yaml file path to report the user
234 $queryparser_error->{ fallback
} = ( defined $queryparser_file ) ?
0 : 1;
235 $queryparser_error->{ file
} = ( defined $queryparser_file )
237 : $queryparser_fallback_file;
238 # Report error data to the template
239 $template->param( QueryParserError
=> $queryparser_error );
241 # Check for an absent queryparser_config entry in koha-conf.xml
242 if ( ! defined $queryparser_file ) {
243 # Not an error but a warning for the missing entry in koha-conf-xml
244 push @xml_config_warnings, {
245 error
=> 'queryparser_entry_missing',
246 file
=> $queryparser_fallback_file
252 # Test Zebra facets configuration
253 if ( !defined C4
::Context
->config('use_zebra_facets') ) {
254 push @xml_config_warnings, { error
=> 'use_zebra_facets_entry_missing' };
256 if ( C4
::Context
->config('use_zebra_facets') &&
257 C4
::Context
->config('zebra_bib_index_mode') ) {
258 # use_zebra_facets works with DOM
259 push @xml_config_warnings, {
260 error
=> 'use_zebra_facets_needs_dom'
261 } if C4
::Context
->config('zebra_bib_index_mode') ne 'dom' ;
266 if ( C4
::Context
->preference('ILLModule') ) {
267 my $warnILLConfiguration = 0;
268 my $ill_config_from_file = C4
::Context
->config("interlibrary_loans");
269 my $ill_config = Koha
::Illrequest
::Config
->new;
271 my $available_ill_backends =
272 ( scalar @
{ $ill_config->available_backends } > 0 );
275 if ( !$available_ill_backends ) {
276 $template->param( no_ill_backends
=> 1 );
277 $warnILLConfiguration = 1;
281 if ( !Koha
::Patron
::Categories
->find($ill_config->partner_code) ) {
282 $template->param( ill_partner_code_doesnt_exist
=> $ill_config->partner_code );
283 $warnILLConfiguration = 1;
286 if ( !$ill_config_from_file->{partner_code
} ) {
287 # partner code not defined
288 $template->param( ill_partner_code_not_defined
=> 1 );
289 $warnILLConfiguration = 1;
292 $template->param( warnILLConfiguration
=> $warnILLConfiguration );
295 # Sco Patron should not contain any other perms than circulate => self_checkout
296 if ( C4
::Context
->preference('WebBasedSelfCheck')
297 and C4
::Context
->preference('AutoSelfCheckAllowed')
299 my $userid = C4
::Context
->preference('AutoSelfCheckID');
300 my $all_permissions = C4
::Auth
::get_user_subpermissions
( $userid );
301 my ( $has_self_checkout_perm, $has_other_permissions );
302 while ( my ( $module, $permissions ) = each %$all_permissions ) {
303 if ( $module eq 'circulate' ) {
304 while ( my ( $permission, $flag ) = each %$permissions ) {
305 if ( $permission eq 'self_checkout' ) {
306 $has_self_checkout_perm = 1;
308 $has_other_permissions = 1;
312 $has_other_permissions = 1;
316 AutoSelfCheckPatronDoesNotHaveSelfCheckPerm
=> not ( $has_self_checkout_perm ),
317 AutoSelfCheckPatronHasTooManyPerm
=> $has_other_permissions,
322 my $dbh = C4
::Context
->dbh;
323 my $patrons = $dbh->selectall_arrayref(
324 q
|select b
.borrowernumber from borrowers b
join deletedborrowers db on b
.borrowernumber
=db
.borrowernumber
|,
327 my $biblios = $dbh->selectall_arrayref(
328 q
|select b
.biblionumber from biblio b
join deletedbiblio db on b
.biblionumber
=db
.biblionumber
|,
331 my $items = $dbh->selectall_arrayref(
332 q
|select i
.itemnumber from items i
join deleteditems di on i
.itemnumber
=di
.itemnumber
|,
335 my $checkouts = $dbh->selectall_arrayref(
336 q
|select i
.issue_id from issues i
join old_issues oi on i
.issue_id
=oi
.issue_id
|,
339 my $holds = $dbh->selectall_arrayref(
340 q
|select r
.reserve_id from reserves r
join old_reserves o on r
.reserve_id
=o
.reserve_id
|,
343 if ( @
$patrons or @
$biblios or @
$items or @
$checkouts or @
$holds ) {
346 ai_patrons
=> $patrons,
347 ai_biblios
=> $biblios,
349 ai_checkouts
=> $checkouts,
354 my %versions = C4
::Context
::get_versions
();
357 kohaVersion
=> $versions{'kohaVersion'},
358 osVersion
=> $versions{'osVersion'},
359 perlPath
=> $perl_path,
360 perlVersion
=> $versions{'perlVersion'},
361 perlIncPath
=> [ map { perlinc
=> $_ }, @INC ],
362 mysqlVersion
=> $versions{'mysqlVersion'},
363 apacheVersion
=> $versions{'apacheVersion'},
364 zebraVersion
=> $zebraVersion,
365 prefBiblioAddsAuthorities
=> $prefBiblioAddsAuthorities,
366 prefAutoCreateAuthorities
=> $prefAutoCreateAuthorities,
367 warnPrefBiblioAddsAuthorities
=> $warnPrefBiblioAddsAuthorities,
368 warnPrefEasyAnalyticalRecords
=> $warnPrefEasyAnalyticalRecords,
369 warnPrefAnonymousPatron
=> $warnPrefAnonymousPatron,
370 warnPrefAnonymousPatron_PatronDoesNotExist
=> $warnPrefAnonymousPatron_PatronDoesNotExist,
371 errZebraConnection
=> $errZebraConnection,
372 warnIsRootUser
=> $warnIsRootUser,
373 warnNoActiveCurrency
=> $warnNoActiveCurrency,
374 warnNoTemplateCaching
=> ( C4
::Context
->config('template_cache_dir') ?
0 : 1 ),
375 xml_config_warnings
=> \
@xml_config_warnings,
376 warnStatisticsFieldsError
=> $warnStatisticsFieldsError,
381 my $perl_modules = C4
::Installer
::PerlModules
->new;
382 $perl_modules->versions_info;
384 my @pm_types = qw(missing_pm upgrade_pm current_pm);
386 foreach my $pm_type(@pm_types) {
387 my $modules = $perl_modules->get_attr($pm_type);
388 foreach (@
$modules) {
389 my ($module, $stats) = each %$_;
394 version
=> $stats->{'cur_ver'},
395 missing
=> ($pm_type eq 'missing_pm' ?
1 : 0),
396 upgrade
=> ($pm_type eq 'upgrade_pm' ?
1 : 0),
397 current
=> ($pm_type eq 'current_pm' ?
1 : 0),
398 require => $stats->{'required'},
399 reqversion
=> $stats->{'min_ver'},
405 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
410 foreach (@components) {
412 unless (++$counter % 4) {
413 push (@
$table, {row
=> $row});
417 # Processing the last line (if there are any modules left)
418 if (scalar(@
$row) > 0) {
419 # Extending $row to the table size
421 # Pushing the last line
422 push (@
$table, {row
=> $row});
426 $template->param( table
=> $table );
429 ## ------------------------------------------
430 ## Koha time line code
434 if ( defined C4
::Context
->config('docdir') ) {
435 $docdir = C4
::Context
->config('docdir');
437 # if no <docdir> is defined in koha-conf.xml, use the default location
438 # this is a work-around to stop breakage on upgraded Kohas, bug 8911
439 $docdir = C4
::Context
->config('intranetdir') . '/docs';
442 if ( open( my $file, "<:encoding(UTF-8)", "$docdir" . "/history.txt" ) ) {
452 shift @lines; #remove header row
455 my ( $epoch, $date, $desc, $tag ) = split(/\t/);
456 if(!$desc && $date=~ /(?<=\d{4})\s+/) {
457 ($date, $desc)= ($`, $');
469 #foreach my $row2 (@rows2) {
472 push( @$table2, { row2 => $row2 } );
476 $template->param( table2 => $table2 );
478 $template->param( timeline_read_error => 1 );
481 output_html_with_http_headers $query, $cookie, $template->output;