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 $effective_caching_method = ref(Koha::Caches->get_instance->cache);
81 effective_caching_method => $effective_caching_method,
82 memcached_servers => $memcached_servers,
83 memcached_namespace => $memcached_namespace,
84 memcached_running => Koha::Caches->get_instance->memcached_cache
87 # Additional system information for warnings
89 my $warnStatisticsFieldsError;
90 my $prefStatisticsFields = C4::Context->preference('StatisticsFields');
91 if ($prefStatisticsFields) {
92 $warnStatisticsFieldsError = $prefStatisticsFields
93 unless ( $prefStatisticsFields eq C4::Members::Statistics->get_fields() );
96 my $prefAutoCreateAuthorities = C4::Context->preference('AutoCreateAuthorities');
97 my $prefBiblioAddsAuthorities = C4::Context->preference('BiblioAddsAuthorities');
98 my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBiblioAddsAuthorities) );
100 my $prefEasyAnalyticalRecords = C4::Context->preference('EasyAnalyticalRecords');
101 my $prefUseControlNumber = C4::Context->preference('UseControlNumber');
102 my $warnPrefEasyAnalyticalRecords = ( $prefEasyAnalyticalRecords && $prefUseControlNumber );
103 my $warnPrefAnonymousPatron = (
104 C4::Context->preference('OPACPrivacy')
105 and not C4::Context->preference('AnonymousPatron')
108 my $anonymous_patron = Koha::Patrons->find( C4::Context->preference('AnonymousPatron') );
109 my $warnPrefAnonymousPatron_PatronDoesNotExist = ( not $anonymous_patron and Koha::Patrons->search({ privacy => 2 })->count );
111 my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode();
113 my $warnIsRootUser = (! $loggedinuser);
115 my $warnNoActiveCurrency = (! defined Koha::Acquisition::Currencies->get_active);
116 my @xml_config_warnings;
118 my $context = new C4::Context;
120 if ( ! defined C4::Context->config('zebra_bib_index_mode') ) {
121 push @xml_config_warnings, {
122 error => 'zebra_bib_index_mode_warn'
124 if ($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) {
125 push @xml_config_warnings, {
126 error => 'zebra_bib_mode_seems_grs1'
130 push @xml_config_warnings, {
131 error => 'zebra_bib_mode_seems_dom'
135 push @xml_config_warnings, { error => 'zebra_bib_grs_warn' }
136 if C4::Context->config('zebra_bib_index_mode') eq 'grs1';
139 if ( (C4::Context->config('zebra_bib_index_mode') eq 'dom') &&
140 ($context->{'server'}->{'biblioserver'}->{'config'} !~ /zebra-biblios-dom.cfg/) ) {
142 push @xml_config_warnings, {
143 error => 'zebra_bib_index_mode_mismatch_warn'
147 if ( (C4::Context->config('zebra_bib_index_mode') eq 'grs1') &&
148 ($context->{'server'}->{'biblioserver'}->{'config'} =~ /zebra-biblios-dom.cfg/) ) {
150 push @xml_config_warnings, {
151 error => 'zebra_bib_index_mode_mismatch_warn'
155 if ( ! defined C4::Context->config('zebra_auth_index_mode') ) {
156 push @xml_config_warnings, {
157 error => 'zebra_auth_index_mode_warn'
159 if ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) {
160 push @xml_config_warnings, {
161 error => 'zebra_auth_mode_seems_grs1'
165 push @xml_config_warnings, {
166 error => 'zebra_auth_mode_seems_dom'
170 push @xml_config_warnings, { error => 'zebra_auth_grs_warn' }
171 if C4::Context->config('zebra_auth_index_mode') eq 'grs1';
174 if ( (C4::Context->config('zebra_auth_index_mode') eq 'dom') && ($context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/) ) {
175 push @xml_config_warnings, {
176 error => 'zebra_auth_index_mode_mismatch_warn'
180 if ( (C4::Context->config('zebra_auth_index_mode') eq 'grs1') && ($context->{'server'}->{'authorityserver'}->{'config'} =~ /zebra-authorities-dom.cfg/) ) {
181 push @xml_config_warnings, {
182 error => 'zebra_auth_index_mode_mismatch_warn'
186 if ( ! defined C4::Context->config('log4perl_conf') ) {
187 push @xml_config_warnings, {
188 error => 'log4perl_entry_missing'
192 if ( ! defined C4::Context->config('upload_path') ) {
193 if ( Koha::Config::SysPrefs->find('OPACBaseURL')->value ) {
194 # OPACBaseURL seems to be set
195 push @xml_config_warnings, {
196 error => 'uploadpath_entry_missing'
199 push @xml_config_warnings, {
200 error => 'uploadpath_and_opacbaseurl_entry_missing'
205 # Test QueryParser configuration sanity
206 if ( C4::Context->preference( 'UseQueryParser' ) ) {
207 # Get the QueryParser configuration file name
208 my $queryparser_file = C4::Context->config( 'queryparser_config' );
209 my $queryparser_fallback_file = '/etc/koha/searchengine/queryparser.yaml';
210 # Check QueryParser is functional
211 my $QParser = C4::Context->queryparser();
212 my $queryparser_error = {};
213 if ( ! defined $QParser || ref($QParser) ne 'Koha::QueryParser::Driver::PQF' ) {
214 # Error initializing the QueryParser object
215 # Get the used queryparser.yaml file path to report the user
216 $queryparser_error->{ fallback } = ( defined $queryparser_file ) ? 0 : 1;
217 $queryparser_error->{ file } = ( defined $queryparser_file )
219 : $queryparser_fallback_file;
220 # Report error data to the template
221 $template->param( QueryParserError => $queryparser_error );
223 # Check for an absent queryparser_config entry in koha-conf.xml
224 if ( ! defined $queryparser_file ) {
225 # Not an error but a warning for the missing entry in koha-conf-xml
226 push @xml_config_warnings, {
227 error => 'queryparser_entry_missing',
228 file => $queryparser_fallback_file
234 # Test Zebra facets configuration
235 if ( !defined C4::Context->config('use_zebra_facets') ) {
236 push @xml_config_warnings, { error => 'use_zebra_facets_entry_missing' };
238 if ( C4::Context->config('use_zebra_facets') &&
239 C4::Context->config('zebra_bib_index_mode') ) {
240 # use_zebra_facets works with DOM
241 push @xml_config_warnings, {
242 error => 'use_zebra_facets_needs_dom'
243 } if C4::Context->config('zebra_bib_index_mode') ne 'dom' ;
247 # Sco Patron should not contain any other perms than circulate => self_checkout
248 if ( C4::Context->preference('WebBasedSelfCheck')
249 and C4::Context->preference('AutoSelfCheckAllowed')
251 my $userid = C4::Context->preference('AutoSelfCheckID');
252 my $all_permissions = C4::Auth::get_user_subpermissions( $userid );
253 my ( $has_self_checkout_perm, $has_other_permissions );
254 while ( my ( $module, $permissions ) = each %$all_permissions ) {
255 if ( $module eq 'circulate' ) {
256 while ( my ( $permission, $flag ) = each %$permissions ) {
257 if ( $permission eq 'self_checkout' ) {
258 $has_self_checkout_perm = 1;
260 $has_other_permissions = 1;
264 $has_other_permissions = 1;
268 AutoSelfCheckPatronDoesNotHaveSelfCheckPerm => not ( $has_self_checkout_perm ),
269 AutoSelfCheckPatronHasTooManyPerm => $has_other_permissions,
275 my %versions = C4::Context::get_versions();
278 kohaVersion => $versions{'kohaVersion'},
279 osVersion => $versions{'osVersion'},
280 perlPath => $perl_path,
281 perlVersion => $versions{'perlVersion'},
282 perlIncPath => [ map { perlinc => $_ }, @INC ],
283 mysqlVersion => $versions{'mysqlVersion'},
284 apacheVersion => $versions{'apacheVersion'},
285 zebraVersion => $zebraVersion,
286 prefBiblioAddsAuthorities => $prefBiblioAddsAuthorities,
287 prefAutoCreateAuthorities => $prefAutoCreateAuthorities,
288 warnPrefBiblioAddsAuthorities => $warnPrefBiblioAddsAuthorities,
289 warnPrefEasyAnalyticalRecords => $warnPrefEasyAnalyticalRecords,
290 warnPrefAnonymousPatron => $warnPrefAnonymousPatron,
291 warnPrefAnonymousPatron_PatronDoesNotExist => $warnPrefAnonymousPatron_PatronDoesNotExist,
292 errZebraConnection => $errZebraConnection,
293 warnIsRootUser => $warnIsRootUser,
294 warnNoActiveCurrency => $warnNoActiveCurrency,
295 xml_config_warnings => \@xml_config_warnings,
296 warnStatisticsFieldsError => $warnStatisticsFieldsError,
301 my $perl_modules = C4::Installer::PerlModules->new;
302 $perl_modules->version_info;
304 my @pm_types = qw(missing_pm upgrade_pm current_pm);
306 foreach my $pm_type(@pm_types) {
307 my $modules = $perl_modules->get_attr($pm_type);
308 foreach (@$modules) {
309 my ($module, $stats) = each %$_;
314 version => $stats->{'cur_ver'},
315 missing => ($pm_type eq 'missing_pm' ? 1 : 0),
316 upgrade => ($pm_type eq 'upgrade_pm' ? 1 : 0),
317 current => ($pm_type eq 'current_pm' ? 1 : 0),
318 require => $stats->{'required'},
319 reqversion => $stats->{'min_ver'},
325 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
330 foreach (@components) {
332 unless (++$counter % 4) {
333 push (@$table, {row => $row});
337 # Processing the last line (if there are any modules left)
338 if (scalar(@$row) > 0) {
339 # Extending $row to the table size
341 # Pushing the last line
342 push (@$table, {row => $row});
346 $template->param( table => $table );
349 ## ------------------------------------------
350 ## Koha time line code
354 if ( defined C4::Context->config('docdir') ) {
355 $docdir = C4::Context->config('docdir');
357 # if no <docdir> is defined in koha-conf.xml, use the default location
358 # this is a work-around to stop breakage on upgraded Kohas, bug 8911
359 $docdir = C4::Context->config('intranetdir') . '/docs';
362 if ( open( my $file, "<:encoding(UTF-8)", "$docdir" . "/history.txt" ) ) {
372 shift @lines; #remove header row
375 my ( $date, $desc, $tag ) = split(/\t/);
376 if(!$desc && $date=~ /(?<=\d{4})\s+/) {
377 ($date, $desc)= ($`, $');
389 #foreach my $row2 (@rows2) {
392 push( @$table2, { row2 => $row2 } );
396 $template->param( table2 => $table2 );
398 $template->param( timeline_read_error => 1 );
401 output_html_with_http_headers $query, $cookie, $template->output;