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;
40 use Koha::Config::SysPrefs;
41 use C4::Members::Statistics;
43 #use Smart::Comments '####';
46 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
48 template_name => "about.tt",
52 flagsrequired => { catalogue => 1 },
59 $perl_path .= $Config{_exe} unless $perl_path =~ m/$Config{_exe}$/i;
62 my $zebraVersion = `zebraidx -V`;
64 # Check running PSGI env
65 if ( any { /(^psgi\.|^plack\.)/i } keys %ENV ) {
68 psgi_server => ($ENV{ PLACK_ENV }) ? "Plack ($ENV{PLACK_ENV})" :
69 ($ENV{ MOD_PERL }) ? "mod_perl ($ENV{MOD_PERL})" :
74 # Memcached configuration
75 my $memcached_servers = $ENV{MEMCACHED_SERVERS} || C4::Context->config('memcached_servers');
76 my $memcached_namespace = $ENV{MEMCACHED_NAMESPACE} || C4::Context->config('memcached_namespace') // 'koha';
78 my $cache = Koha::Caches->get_instance;
79 my $effective_caching_method = ref($cache->cache);
80 # Memcached may have been running when plack has been initialized but could have been stopped since
81 # FIXME What are the consequences of that??
82 my $is_memcached_still_active = $cache->set_in_cache('test_for_about_page', "just a simple value");
85 effective_caching_method => $effective_caching_method,
86 memcached_servers => $memcached_servers,
87 memcached_namespace => $memcached_namespace,
88 is_memcached_still_active => $is_memcached_still_active,
89 memcached_running => Koha::Caches->get_instance->memcached_cache
92 # Additional system information for warnings
94 my $warnStatisticsFieldsError;
95 my $prefStatisticsFields = C4::Context->preference('StatisticsFields');
96 if ($prefStatisticsFields) {
97 $warnStatisticsFieldsError = $prefStatisticsFields
98 unless ( $prefStatisticsFields eq C4::Members::Statistics->get_fields() );
101 my $prefAutoCreateAuthorities = C4::Context->preference('AutoCreateAuthorities');
102 my $prefBiblioAddsAuthorities = C4::Context->preference('BiblioAddsAuthorities');
103 my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBiblioAddsAuthorities) );
105 my $prefEasyAnalyticalRecords = C4::Context->preference('EasyAnalyticalRecords');
106 my $prefUseControlNumber = C4::Context->preference('UseControlNumber');
107 my $warnPrefEasyAnalyticalRecords = ( $prefEasyAnalyticalRecords && $prefUseControlNumber );
108 my $warnPrefAnonymousPatron = (
109 C4::Context->preference('OPACPrivacy')
110 and not C4::Context->preference('AnonymousPatron')
113 my $anonymous_patron = Koha::Patrons->find( C4::Context->preference('AnonymousPatron') );
114 my $warnPrefAnonymousPatron_PatronDoesNotExist = ( not $anonymous_patron and Koha::Patrons->search({ privacy => 2 })->count );
116 my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode();
118 my $warnIsRootUser = (! $loggedinuser);
120 my $warnNoActiveCurrency = (! defined Koha::Acquisition::Currencies->get_active);
121 my @xml_config_warnings;
123 my $context = new C4::Context;
125 if ( ! defined C4::Context->config('zebra_bib_index_mode') ) {
126 push @xml_config_warnings, {
127 error => 'zebra_bib_index_mode_warn'
129 if ($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) {
130 push @xml_config_warnings, {
131 error => 'zebra_bib_mode_seems_grs1'
135 push @xml_config_warnings, {
136 error => 'zebra_bib_mode_seems_dom'
140 push @xml_config_warnings, { error => 'zebra_bib_grs_warn' }
141 if C4::Context->config('zebra_bib_index_mode') eq 'grs1';
144 if ( (C4::Context->config('zebra_bib_index_mode') eq 'dom') &&
145 ($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) ) {
147 push @xml_config_warnings, {
148 error => 'zebra_bib_index_mode_mismatch_warn'
152 if ( (C4::Context->config('zebra_bib_index_mode') eq 'grs1') &&
153 ($context->{'server'}->{'biblioserver'}->{'config'} =~ /zebra-biblios-dom.cfg/) ) {
155 push @xml_config_warnings, {
156 error => 'zebra_bib_index_mode_mismatch_warn'
160 if ( ! defined C4::Context->config('zebra_auth_index_mode') ) {
161 push @xml_config_warnings, {
162 error => 'zebra_auth_index_mode_warn'
164 if ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) {
165 push @xml_config_warnings, {
166 error => 'zebra_auth_mode_seems_grs1'
170 push @xml_config_warnings, {
171 error => 'zebra_auth_mode_seems_dom'
175 push @xml_config_warnings, { error => 'zebra_auth_grs_warn' }
176 if C4::Context->config('zebra_auth_index_mode') eq 'grs1';
179 if ( (C4::Context->config('zebra_auth_index_mode') eq 'dom') && ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) ) {
180 push @xml_config_warnings, {
181 error => 'zebra_auth_index_mode_mismatch_warn'
185 if ( (C4::Context->config('zebra_auth_index_mode') eq 'grs1') && ($context->{'server'}->{'authorityserver'}->{'config'} =~ /zebra-authorities-dom.cfg/) ) {
186 push @xml_config_warnings, {
187 error => 'zebra_auth_index_mode_mismatch_warn'
191 if ( ! defined C4::Context->config('log4perl_conf') ) {
192 push @xml_config_warnings, {
193 error => 'log4perl_entry_missing'
197 if ( ! defined C4::Context->config('upload_path') ) {
198 if ( Koha::Config::SysPrefs->find('OPACBaseURL')->value ) {
199 # OPACBaseURL seems to be set
200 push @xml_config_warnings, {
201 error => 'uploadpath_entry_missing'
204 push @xml_config_warnings, {
205 error => 'uploadpath_and_opacbaseurl_entry_missing'
210 # Test QueryParser configuration sanity
211 if ( C4::Context->preference( 'UseQueryParser' ) ) {
212 # Get the QueryParser configuration file name
213 my $queryparser_file = C4::Context->config( 'queryparser_config' );
214 my $queryparser_fallback_file = '/etc/koha/searchengine/queryparser.yaml';
215 # Check QueryParser is functional
216 my $QParser = C4::Context->queryparser();
217 my $queryparser_error = {};
218 if ( ! defined $QParser || ref($QParser) ne 'Koha::QueryParser::Driver::PQF' ) {
219 # Error initializing the QueryParser object
220 # Get the used queryparser.yaml file path to report the user
221 $queryparser_error->{ fallback } = ( defined $queryparser_file ) ? 0 : 1;
222 $queryparser_error->{ file } = ( defined $queryparser_file )
224 : $queryparser_fallback_file;
225 # Report error data to the template
226 $template->param( QueryParserError => $queryparser_error );
228 # Check for an absent queryparser_config entry in koha-conf.xml
229 if ( ! defined $queryparser_file ) {
230 # Not an error but a warning for the missing entry in koha-conf-xml
231 push @xml_config_warnings, {
232 error => 'queryparser_entry_missing',
233 file => $queryparser_fallback_file
239 # Test Zebra facets configuration
240 if ( !defined C4::Context->config('use_zebra_facets') ) {
241 push @xml_config_warnings, { error => 'use_zebra_facets_entry_missing' };
243 if ( C4::Context->config('use_zebra_facets') &&
244 C4::Context->config('zebra_bib_index_mode') ) {
245 # use_zebra_facets works with DOM
246 push @xml_config_warnings, {
247 error => 'use_zebra_facets_needs_dom'
248 } if C4::Context->config('zebra_bib_index_mode') ne 'dom' ;
252 # Sco Patron should not contain any other perms than circulate => self_checkout
253 if ( C4::Context->preference('WebBasedSelfCheck')
254 and C4::Context->preference('AutoSelfCheckAllowed')
256 my $userid = C4::Context->preference('AutoSelfCheckID');
257 my $all_permissions = C4::Auth::get_user_subpermissions( $userid );
258 my ( $has_self_checkout_perm, $has_other_permissions );
259 while ( my ( $module, $permissions ) = each %$all_permissions ) {
260 if ( $module eq 'circulate' ) {
261 while ( my ( $permission, $flag ) = each %$permissions ) {
262 if ( $permission eq 'self_checkout' ) {
263 $has_self_checkout_perm = 1;
265 $has_other_permissions = 1;
269 $has_other_permissions = 1;
273 AutoSelfCheckPatronDoesNotHaveSelfCheckPerm => not ( $has_self_checkout_perm ),
274 AutoSelfCheckPatronHasTooManyPerm => $has_other_permissions,
280 my %versions = C4::Context::get_versions();
283 kohaVersion => $versions{'kohaVersion'},
284 osVersion => $versions{'osVersion'},
285 perlPath => $perl_path,
286 perlVersion => $versions{'perlVersion'},
287 perlIncPath => [ map { perlinc => $_ }, @INC ],
288 mysqlVersion => $versions{'mysqlVersion'},
289 apacheVersion => $versions{'apacheVersion'},
290 zebraVersion => $zebraVersion,
291 prefBiblioAddsAuthorities => $prefBiblioAddsAuthorities,
292 prefAutoCreateAuthorities => $prefAutoCreateAuthorities,
293 warnPrefBiblioAddsAuthorities => $warnPrefBiblioAddsAuthorities,
294 warnPrefEasyAnalyticalRecords => $warnPrefEasyAnalyticalRecords,
295 warnPrefAnonymousPatron => $warnPrefAnonymousPatron,
296 warnPrefAnonymousPatron_PatronDoesNotExist => $warnPrefAnonymousPatron_PatronDoesNotExist,
297 errZebraConnection => $errZebraConnection,
298 warnIsRootUser => $warnIsRootUser,
299 warnNoActiveCurrency => $warnNoActiveCurrency,
300 xml_config_warnings => \@xml_config_warnings,
301 warnStatisticsFieldsError => $warnStatisticsFieldsError,
306 my $perl_modules = C4::Installer::PerlModules->new;
307 $perl_modules->version_info;
309 my @pm_types = qw(missing_pm upgrade_pm current_pm);
311 foreach my $pm_type(@pm_types) {
312 my $modules = $perl_modules->get_attr($pm_type);
313 foreach (@$modules) {
314 my ($module, $stats) = each %$_;
319 version => $stats->{'cur_ver'},
320 missing => ($pm_type eq 'missing_pm' ? 1 : 0),
321 upgrade => ($pm_type eq 'upgrade_pm' ? 1 : 0),
322 current => ($pm_type eq 'current_pm' ? 1 : 0),
323 require => $stats->{'required'},
324 reqversion => $stats->{'min_ver'},
330 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
335 foreach (@components) {
337 unless (++$counter % 4) {
338 push (@$table, {row => $row});
342 # Processing the last line (if there are any modules left)
343 if (scalar(@$row) > 0) {
344 # Extending $row to the table size
346 # Pushing the last line
347 push (@$table, {row => $row});
351 $template->param( table => $table );
354 ## ------------------------------------------
355 ## Koha time line code
359 if ( defined C4::Context->config('docdir') ) {
360 $docdir = C4::Context->config('docdir');
362 # if no <docdir> is defined in koha-conf.xml, use the default location
363 # this is a work-around to stop breakage on upgraded Kohas, bug 8911
364 $docdir = C4::Context->config('intranetdir') . '/docs';
367 if ( open( my $file, "<:encoding(UTF-8)", "$docdir" . "/history.txt" ) ) {
377 shift @lines; #remove header row
380 my ( $date, $desc, $tag ) = split(/\t/);
381 if(!$desc && $date=~ /(?<=\d{4})\s+/) {
382 ($date, $desc)= ($`, $');
394 #foreach my $row2 (@rows2) {
397 push( @$table2, { row2 => $row2 } );
401 $template->param( table2 => $table2 );
403 $template->param( timeline_read_error => 1 );
406 output_html_with_http_headers $query, $cookie, $template->output;