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 DateTime::TimeZone;
27 use File::Slurp qw( read_file );
28 use List::MoreUtils qw( any );
29 use Module::Load::Conditional qw( can_load );
30 use Config qw( %Config );
31 use Search::Elasticsearch;
32 use Try::Tiny qw( catch try );
36 use C4::Output qw( output_html_with_http_headers );
37 use C4::Auth qw( get_template_and_user get_user_subpermissions );
39 use C4::Installer::PerlModules;
42 use Koha::DateUtils qw( dt_from_string output_pref );
43 use Koha::Acquisition::Currencies;
44 use Koha::Authorities;
45 use Koha::BackgroundJob;
46 use Koha::BiblioFrameworks;
50 use Koha::Patron::Categories;
53 use Koha::Config::SysPrefs;
54 use Koha::Illrequest::Config;
55 use Koha::SearchEngine::Elasticsearch;
57 use Koha::Filter::MARC::ViewPolicy;
59 use C4::Members::Statistics;
62 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
64 template_name => "about.tt",
67 flagsrequired => { catalogue => 1 },
71 my $config_timezone = C4::Context->config('timezone') // '';
72 my $config_invalid = !DateTime::TimeZone->is_valid_name( $config_timezone );
73 my $env_timezone = $ENV{TZ} // '';
74 my $env_invalid = !DateTime::TimeZone->is_valid_name( $env_timezone );
75 my $actual_bad_tz_fallback = 0;
77 if ( $config_timezone ne '' &&
80 $actual_bad_tz_fallback = 1;
82 elsif ( $config_timezone eq '' &&
83 $env_timezone ne '' &&
85 # No config, but bad ENV{TZ}
86 $actual_bad_tz_fallback = 1;
90 actual => C4::Context->tz->name,
91 actual_bad_tz_fallback => $actual_bad_tz_fallback,
92 config => $config_timezone,
93 config_invalid => $config_invalid,
94 environment => $env_timezone,
95 environment_invalid => $env_invalid
99 my $log4perl_config = C4::Context->config("log4perl_conf");
101 if ( ! $log4perl_config ) {
102 push @log4perl_errors, 'missing_config_entry'
105 my @lines = read_file($log4perl_config) or push @log4perl_errors, 'cannot_read_config_file';
106 for my $line ( @lines ) {
107 next unless $line =~ m|log4perl.appender.\w+.filename=(.*)|;
108 push @log4perl_errors, 'logfile_not_writable' unless -w $1;
111 eval {Koha::Logger->get};
112 push @log4perl_errors, 'cannot_init_module' and warn $@ if $@;
113 $template->param( log4perl_errors => @log4perl_errors );
117 time_zone => $time_zone,
118 current_date_and_time => output_pref({ dt => dt_from_string(), dateformat => 'iso' })
123 $perl_path .= $Config{_exe} unless $perl_path =~ m/$Config{_exe}$/i;
126 my $zebraVersion = `zebraidx -V`;
128 # Check running PSGI env
129 if ( any { /(^psgi\.|^plack\.)/i } keys %ENV ) {
132 psgi_server => ($ENV{ PLACK_ENV }) ? "Plack ($ENV{PLACK_ENV})" :
133 ($ENV{ MOD_PERL }) ? "mod_perl ($ENV{MOD_PERL})" :
138 # Memcached configuration
139 my $memcached_servers = $ENV{MEMCACHED_SERVERS} || C4::Context->config('memcached_servers');
140 my $memcached_namespace = $ENV{MEMCACHED_NAMESPACE} || C4::Context->config('memcached_namespace') // 'koha';
142 my $cache = Koha::Caches->get_instance;
143 my $effective_caching_method = ref($cache->cache);
144 # Memcached may have been running when plack has been initialized but could have been stopped since
145 # FIXME What are the consequences of that??
146 my $is_memcached_still_active = $cache->set_in_cache('test_for_about_page', "just a simple value");
148 my $where_is_memcached_config = 'nowhere';
149 if ( $ENV{MEMCACHED_SERVERS} and C4::Context->config('memcached_servers') ) {
150 $where_is_memcached_config = 'both';
151 } elsif ( $ENV{MEMCACHED_SERVERS} and not C4::Context->config('memcached_servers') ) {
152 $where_is_memcached_config = 'ENV_only';
153 } elsif ( C4::Context->config('memcached_servers') ) {
154 $where_is_memcached_config = 'config_only';
158 effective_caching_method => $effective_caching_method,
159 memcached_servers => $memcached_servers,
160 memcached_namespace => $memcached_namespace,
161 is_memcached_still_active => $is_memcached_still_active,
162 where_is_memcached_config => $where_is_memcached_config,
163 memcached_running => Koha::Caches->get_instance->memcached_cache,
166 # Additional system information for warnings
168 my $warnStatisticsFieldsError;
169 my $prefStatisticsFields = C4::Context->preference('StatisticsFields');
170 if ($prefStatisticsFields) {
171 $warnStatisticsFieldsError = $prefStatisticsFields
172 unless ( $prefStatisticsFields eq C4::Members::Statistics->get_fields() );
175 my $prefAutoCreateAuthorities = C4::Context->preference('AutoCreateAuthorities');
176 my $prefBiblioAddsAuthorities = C4::Context->preference('BiblioAddsAuthorities');
177 my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBiblioAddsAuthorities) );
179 my $prefEasyAnalyticalRecords = C4::Context->preference('EasyAnalyticalRecords');
180 my $prefUseControlNumber = C4::Context->preference('UseControlNumber');
181 my $warnPrefEasyAnalyticalRecords = ( $prefEasyAnalyticalRecords && $prefUseControlNumber );
183 my $AnonymousPatron = C4::Context->preference('AnonymousPatron');
184 my $warnPrefAnonymousPatronOPACPrivacy = (
185 C4::Context->preference('OPACPrivacy')
186 and not $AnonymousPatron
188 my $warnPrefAnonymousPatronAnonSuggestions = (
189 C4::Context->preference('AnonSuggestions')
190 and not $AnonymousPatron
193 my $anonymous_patron = Koha::Patrons->find( $AnonymousPatron );
194 my $warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist = ( $AnonymousPatron && C4::Context->preference('AnonSuggestions') && not $anonymous_patron );
196 my $warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist = ( not $anonymous_patron and Koha::Patrons->search({ privacy => 2 })->count );
198 my $warnPrefKohaAdminEmailAddress = !Koha::Email->is_valid(C4::Context->preference('KohaAdminEmailAddress'));
200 my $c = Koha::Items->filter_by_visible_in_opac->count;
201 my @warnings = C4::Context->dbh->selectrow_array('SHOW WARNINGS');
202 my $warnPrefOpacHiddenItems = $warnings[2];
204 my $invalid_yesno = Koha::Config::SysPrefs->search(
207 value => { -or => { 'is' => undef, -not_in => [ "1", "0" ] } }
210 $template->param( invalid_yesno => $invalid_yesno );
212 my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode();
214 my $warnIsRootUser = (! $loggedinuser);
216 my $warnNoActiveCurrency = (! defined Koha::Acquisition::Currencies->get_active);
218 my @xml_config_warnings;
220 if ( C4::Context->config('zebra_bib_index_mode')
221 and C4::Context->config('zebra_bib_index_mode') eq 'grs1' )
223 push @xml_config_warnings, { error => 'zebra_bib_index_mode_is_grs1' };
226 if ( C4::Context->config('zebra_auth_index_mode')
227 and C4::Context->config('zebra_auth_index_mode') eq 'grs1' )
229 push @xml_config_warnings, { error => 'zebra_auth_index_mode_is_grs1' };
232 my $authorityserver = C4::Context->zebraconfig('authorityserver');
233 if( ( C4::Context->config('zebra_auth_index_mode')
234 and C4::Context->config('zebra_auth_index_mode') eq 'dom' )
235 && ( $authorityserver->{config} !~ /zebra-authorities-dom.cfg/ ) )
237 push @xml_config_warnings, {
238 error => 'zebra_auth_index_mode_mismatch_warn'
242 if ( ! defined C4::Context->config('log4perl_conf') ) {
243 push @xml_config_warnings, {
244 error => 'log4perl_entry_missing'
248 if ( ! defined C4::Context->config('lockdir') ) {
249 push @xml_config_warnings, {
250 error => 'lockdir_entry_missing'
254 unless ( -w C4::Context->config('lockdir') ) {
255 push @xml_config_warnings, {
256 error => 'lockdir_not_writable',
257 lockdir => C4::Context->config('lockdir')
262 if ( ! defined C4::Context->config('upload_path') ) {
263 if ( Koha::Config::SysPrefs->find('OPACBaseURL')->value ) {
264 # OPACBaseURL seems to be set
265 push @xml_config_warnings, {
266 error => 'uploadpath_entry_missing'
269 push @xml_config_warnings, {
270 error => 'uploadpath_and_opacbaseurl_entry_missing'
275 if ( ! C4::Context->config('tmp_path') ) {
276 my $temporary_directory = C4::Context::temporary_directory;
277 push @xml_config_warnings, {
278 error => 'tmp_path_missing',
279 effective_tmp_dir => $temporary_directory,
283 if( ! C4::Context->config('encryption_key') ) {
284 push @xml_config_warnings, { error => 'encryption_key_missing' };
287 # Test Zebra facets configuration
288 if ( !defined C4::Context->config('use_zebra_facets') ) {
289 push @xml_config_warnings, { error => 'use_zebra_facets_entry_missing' };
292 unless ( Koha::I18N->_base_directory ) {
293 $template->param( warnI18nMissing => 1 );
297 if ( C4::Context->preference('ILLModule') ) {
298 my $warnILLConfiguration = 0;
299 my $ill_config_from_file = C4::Context->config("interlibrary_loans");
300 my $ill_config = Koha::Illrequest::Config->new;
302 my $available_ill_backends =
303 ( scalar @{ $ill_config->available_backends } > 0 );
306 if ( !$available_ill_backends ) {
307 $template->param( no_ill_backends => 1 );
308 $warnILLConfiguration = 1;
312 if ( !Koha::Patron::Categories->find($ill_config->partner_code) ) {
313 $template->param( ill_partner_code_doesnt_exist => $ill_config->partner_code );
314 $warnILLConfiguration = 1;
317 if ( !$ill_config_from_file->{partner_code} ) {
318 # partner code not defined
319 $template->param( ill_partner_code_not_defined => 1 );
320 $warnILLConfiguration = 1;
324 if ( !$ill_config_from_file->{branch} ) {
326 $template->param( ill_branch_not_defined => 1 );
327 $warnILLConfiguration = 1;
330 $template->param( warnILLConfiguration => $warnILLConfiguration );
336 OPACXSLTDetailsDisplay
338 OPACXSLTResultsDisplay
344 for my $p ( @xslt_prefs ) {
345 my $xsl_filename = C4::XSLT::get_xsl_filename( $p );
346 next if -e $xsl_filename;
350 value => C4::Context->preference("$p"),
351 filename => $xsl_filename
355 $template->param( warnXSLT => \@warnXSLT ) if @warnXSLT;
358 if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) {
359 # Check ES configuration health and runtime status
364 my $es_has_missing = 0;
368 $es_conf = Koha::SearchEngine::Elasticsearch::_read_configuration();
371 if ( ref($_) eq 'Koha::Exceptions::Config::MissingEntry' ) {
372 $template->param( elasticsearch_fatal_config_error => $_->message );
373 $es_config_error = 1;
376 if ( !$es_config_error ) {
378 my $biblios_index_name = $es_conf->{index_name} . "_" . $Koha::SearchEngine::BIBLIOS_INDEX;
379 my $authorities_index_name = $es_conf->{index_name} . "_" . $Koha::SearchEngine::AUTHORITIES_INDEX;
381 my @indexes = ($biblios_index_name, $authorities_index_name);
382 # TODO: When new indexes get added, we could have other ways to
383 # fetch the list of available indexes (e.g. plugins, etc)
384 $es_status->{nodes} = $es_conf->{nodes};
385 my $es = Search::Elasticsearch->new({ nodes => $es_conf->{nodes} });
386 my $es_status->{version} = $es->info->{version}->{number};
388 foreach my $index ( @indexes ) {
391 $index_count = $es->indices->stats( index => $index )
392 ->{_all}{primaries}{docs}{count};
395 if ( ref($_) eq 'Search::Elasticsearch::Error::Missing' ) {
396 push @{ $es_status->{errors} }, "Index not found ($index)";
399 elsif ( ref($_) eq 'Search::Elasticsearch::Error::NoNodes' ) {
403 # TODO: when time comes, we will cover more use cases
409 my $missing_count = 0;
410 if ( $index eq $biblios_index_name ) {
411 $db_count = Koha::Biblios->search->count;
412 } elsif ( $index eq $authorities_index_name ) {
413 $db_count = Koha::Authorities->search->count;
415 if ( $db_count != -1 && $index_count != -1 ) {
416 $missing_count = $db_count - $index_count;
417 $es_has_missing = 1 if $missing_count > 0;
419 push @{ $es_status->{indexes} },
421 index_name => $index,
422 index_count => $index_count,
423 db_count => $db_count,
424 missing_count => $missing_count,
427 $es_status->{running} = $es_running;
430 elasticsearch_status => $es_status,
431 elasticsearch_has_missing => $es_has_missing,
436 if ( C4::Context->preference('RESTOAuth2ClientCredentials') ) {
437 # Do we have the required deps?
438 unless ( can_load( modules => { 'Net::OAuth2::AuthorizationServer' => undef }) ) {
439 $template->param( oauth2_missing_deps => 1 );
443 # Sco Patron should not contain any other perms than circulate => self_checkout
444 if ( C4::Context->preference('WebBasedSelfCheck')
445 and C4::Context->preference('AutoSelfCheckAllowed')
447 my $userid = C4::Context->preference('AutoSelfCheckID');
448 my $all_permissions = C4::Auth::get_user_subpermissions( $userid );
449 my ( $has_self_checkout_perm, $has_other_permissions );
450 while ( my ( $module, $permissions ) = each %$all_permissions ) {
451 if ( $module eq 'self_check' ) {
452 while ( my ( $permission, $flag ) = each %$permissions ) {
453 if ( $permission eq 'self_checkout_module' ) {
454 $has_self_checkout_perm = 1;
456 $has_other_permissions = 1;
460 $has_other_permissions = 1;
464 AutoSelfCheckPatronDoesNotHaveSelfCheckPerm => not ( $has_self_checkout_perm ),
465 AutoSelfCheckPatronHasTooManyPerm => $has_other_permissions,
469 # Test YAML system preferences
470 # FIXME: This is list of current YAML formatted prefs, should by type of preference
472 "UpdateNotForLoanStatusOnCheckin",
474 "BibtexExportAdditionalFields",
475 "RisExportAdditionalFields",
476 "UpdateItemWhenLostFromHoldList",
478 "MarcItemFieldsToOrder",
479 "UpdateitemLocationOnCheckin",
483 foreach my $syspref (@yaml_prefs) {
484 my $yaml = C4::Context->preference( $syspref );
486 eval { YAML::XS::Load( Encode::encode_utf8("$yaml\n\n") ); };
488 push @bad_yaml_prefs, $syspref;
492 $template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs;
495 my $dbh = C4::Context->dbh;
496 my $patrons = $dbh->selectall_arrayref(
497 q|select b.borrowernumber from borrowers b join deletedborrowers db on b.borrowernumber=db.borrowernumber|,
500 my $biblios = $dbh->selectall_arrayref(
501 q|select b.biblionumber from biblio b join deletedbiblio db on b.biblionumber=db.biblionumber|,
504 my $items = $dbh->selectall_arrayref(
505 q|select i.itemnumber from items i join deleteditems di on i.itemnumber=di.itemnumber|,
508 my $checkouts = $dbh->selectall_arrayref(
509 q|select i.issue_id from issues i join old_issues oi on i.issue_id=oi.issue_id|,
512 my $holds = $dbh->selectall_arrayref(
513 q|select r.reserve_id from reserves r join old_reserves o on r.reserve_id=o.reserve_id|,
516 if ( @$patrons or @$biblios or @$items or @$checkouts or @$holds ) {
519 ai_patrons => $patrons,
520 ai_biblios => $biblios,
522 ai_checkouts => $checkouts,
530 my $dbh = C4::Context->dbh;
531 my $units = Koha::CirculationRules->search({ rule_name => 'lengthunit', rule_value => { -not_in => ['days', 'hours'] } });
533 if ( $units->count ) {
535 warnIssuingRules => 1,
541 # Guarantor relationships warnings
543 my $dbh = C4::Context->dbh;
544 my ($bad_relationships_count) = $dbh->selectall_arrayref(q{
547 SELECT relationship FROM borrower_relationships WHERE relationship='_bad_data'
549 SELECT relationship FROM borrowers WHERE relationship='_bad_data') a
552 $bad_relationships_count = $bad_relationships_count->[0]->[0];
554 my $existing_relationships = $dbh->selectall_arrayref(q{
555 SELECT DISTINCT(relationship)
557 SELECT relationship FROM borrower_relationships WHERE relationship IS NOT NULL
559 SELECT relationship FROM borrowers WHERE relationship IS NOT NULL) a
562 my %valid_relationships = map { $_ => 1 } split( /,|\|/, C4::Context->preference('borrowerRelationship') );
563 $valid_relationships{ _bad_data } = 1; # we handle this case in another way
565 my $wrong_relationships = [ grep { !$valid_relationships{ $_->[0] } } @{$existing_relationships} ];
566 if ( @$wrong_relationships or $bad_relationships_count ) {
569 warnRelationships => 1,
572 if ( $wrong_relationships ) {
574 wrong_relationships => $wrong_relationships
577 if ($bad_relationships_count) {
579 bad_relationships_count => $bad_relationships_count,
586 # Test 'bcrypt_settings' config for Pseudonymization
587 $template->param( config_bcrypt_settings_no_set => 1 )
588 if C4::Context->preference('Pseudonymization')
589 and not C4::Context->config('bcrypt_settings');
593 my @frameworkcodes = Koha::BiblioFrameworks->search->get_column('frameworkcode');
594 my @hidden_biblionumbers;
595 push @frameworkcodes, ""; # it's not in the biblio_frameworks table!
596 for my $frameworkcode ( @frameworkcodes ) {
597 my $shouldhidemarc_opac = Koha::Filter::MARC::ViewPolicy->should_hide_marc(
599 frameworkcode => $frameworkcode,
603 push @hidden_biblionumbers, { frameworkcode => $frameworkcode, interface => 'opac' }
604 if $shouldhidemarc_opac->{biblionumber};
606 my $shouldhidemarc_intranet = Koha::Filter::MARC::ViewPolicy->should_hide_marc(
608 frameworkcode => $frameworkcode,
609 interface => "intranet"
612 push @hidden_biblionumbers, { frameworkcode => $frameworkcode, interface => 'intranet' }
613 if $shouldhidemarc_intranet->{biblionumber};
615 $template->param( warnHiddenBiblionumbers => \@hidden_biblionumbers );
619 # BackgroundJob - test connection to message broker
621 Koha::BackgroundJob->connect;
625 $template->param( warnConnectBroker => $@ );
629 my %versions = C4::Context::get_versions();
632 kohaVersion => $versions{'kohaVersion'},
633 osVersion => $versions{'osVersion'},
634 perlPath => $perl_path,
635 perlVersion => $versions{'perlVersion'},
636 perlIncPath => [ map { perlinc => $_ }, @INC ],
637 mysqlVersion => $versions{'mysqlVersion'},
638 apacheVersion => $versions{'apacheVersion'},
639 zebraVersion => $zebraVersion,
640 prefBiblioAddsAuthorities => $prefBiblioAddsAuthorities,
641 prefAutoCreateAuthorities => $prefAutoCreateAuthorities,
642 warnPrefBiblioAddsAuthorities => $warnPrefBiblioAddsAuthorities,
643 warnPrefEasyAnalyticalRecords => $warnPrefEasyAnalyticalRecords,
644 warnPrefAnonymousPatronOPACPrivacy => $warnPrefAnonymousPatronOPACPrivacy,
645 warnPrefAnonymousPatronAnonSuggestions => $warnPrefAnonymousPatronAnonSuggestions,
646 warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist => $warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist,
647 warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist => $warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist,
648 warnPrefKohaAdminEmailAddress => $warnPrefKohaAdminEmailAddress,
649 warnPrefOpacHiddenItems => $warnPrefOpacHiddenItems,
650 errZebraConnection => $errZebraConnection,
651 warnIsRootUser => $warnIsRootUser,
652 warnNoActiveCurrency => $warnNoActiveCurrency,
653 warnNoTemplateCaching => ( C4::Context->config('template_cache_dir') ? 0 : 1 ),
654 xml_config_warnings => \@xml_config_warnings,
655 warnStatisticsFieldsError => $warnStatisticsFieldsError,
660 my $perl_modules = C4::Installer::PerlModules->new;
661 $perl_modules->versions_info;
663 my @pm_types = qw(missing_pm upgrade_pm current_pm);
665 foreach my $pm_type(@pm_types) {
666 my $modules = $perl_modules->get_attr($pm_type);
667 foreach (@$modules) {
668 my ($module, $stats) = each %$_;
673 version => $stats->{'cur_ver'},
674 missing => ($pm_type eq 'missing_pm' ? 1 : 0),
675 upgrade => ($pm_type eq 'upgrade_pm' ? 1 : 0),
676 current => ($pm_type eq 'current_pm' ? 1 : 0),
677 require => $stats->{'required'},
678 reqversion => $stats->{'min_ver'},
679 maxversion => $stats->{'max_ver'},
680 excversion => $stats->{'exc_ver'}
686 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
691 foreach (@components) {
693 unless (++$counter % 4) {
694 push (@$table, {row => $row});
698 # Processing the last line (if there are any modules left)
699 if (scalar(@$row) > 0) {
700 # Extending $row to the table size
702 # Pushing the last line
703 push (@$table, {row => $row});
707 $template->param( table => $table );
710 ## ------------------------------------------
711 ## Koha contributions
713 if ( defined C4::Context->config('docdir') ) {
714 $docdir = C4::Context->config('docdir');
716 # if no <docdir> is defined in koha-conf.xml, use the default location
717 # this is a work-around to stop breakage on upgraded Kohas, bug 8911
718 $docdir = C4::Context->config('intranetdir') . '/docs';
723 -e "$docdir" . "/teams.yaml"
724 ? YAML::XS::LoadFile( "$docdir" . "/teams.yaml" )
726 my $dev_team = (sort {$b <=> $a} (keys %{$teams->{team}}))[0];
727 my $short_version = substr($versions{'kohaVersion'},0,5);
728 my $minor = substr($versions{'kohaVersion'},3,2);
729 my $development_version = ( $minor eq '05' || $minor eq '11' ) ? 0 : 1;
730 $template->param( short_version => $short_version );
731 $template->param( development_version => $development_version );
735 -e "$docdir" . "/contributors.yaml"
736 ? YAML::XS::LoadFile( "$docdir" . "/contributors.yaml" )
738 delete $contributors->{_others_};
739 for my $version ( sort { $a <=> $b } keys %{$teams->{team}} ) {
740 for my $role ( keys %{ $teams->{team}->{$version} } ) {
741 my $normalized_role = "$role";
742 $normalized_role =~ s/s$//;
743 if ( ref( $teams->{team}->{$version}->{$role} ) eq 'ARRAY' ) {
744 for my $contributor ( @{ $teams->{team}->{$version}->{$role} } ) {
745 my $name = $contributor->{name};
746 # Add role to contributors
747 push @{ $contributors->{$name}->{roles}->{$normalized_role} },
749 # Add openhub to teams
750 if ( exists( $contributors->{$name}->{openhub} ) ) {
751 $contributor->{openhub} = $contributors->{$name}->{openhub};
755 elsif ( $role ne 'release_date' ) {
756 my $name = $teams->{team}->{$version}->{$role}->{name};
757 # Add role to contributors
758 push @{ $contributors->{$name}->{roles}->{$normalized_role} },
760 # Add openhub to teams
761 if ( exists( $contributors->{$name}->{openhub} ) ) {
762 $teams->{team}->{$version}->{$role}->{openhub} =
763 $contributors->{$name}->{openhub};
767 $teams->{team}->{$version}->{$role} = DateTime->from_epoch( epoch => $teams->{team}->{$version}->{$role});
772 ## Create last name ordered array of people from contributors
774 { name => $_, ( $contributors->{$_} ? %{ $contributors->{$_} } : () ) }
776 my ($alast) = $a =~ /(\S+)$/;
777 my ($blast) = $b =~ /(\S+)$/;
778 my $cmp = lc($alast||"") cmp lc($blast||"");
781 my ($a2last) = $a =~ /(\S+)\s\S+$/;
782 my ($b2last) = $b =~ /(\S+)\s\S+$/;
783 lc($a2last||"") cmp lc($b2last||"");
784 } keys %$contributors;
786 $template->param( contributors => \@people );
787 $template->param( maintenance_team => $teams->{team}->{$dev_team} );
788 $template->param( release_team => $teams->{team}->{$short_version} );
791 if ( open( my $file, "<:encoding(UTF-8)", "$docdir" . "/history.txt" ) ) {
801 shift @lines; #remove header row
804 my ( $epoch, $date, $desc, $tag ) = split(/\t/);
805 if(!$desc && $date=~ /(?<=\d{4})\s+/) {
806 ($date, $desc)= ($`, $');
818 #foreach my $row2 (@rows2) {
821 push( @$table2, { row2 => $row2 } );
825 $template->param( table2 => $table2 );
827 $template->param( timeline_read_error => 1 );
830 output_html_with_http_headers $query, $cookie, $template->output;