Bug 22417: Remove FIXME in the template
[koha.git] / about.pl
blob2396ad13f40c35c73dc5dab3901435450b38c270
1 #!/usr/bin/perl
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>.
23 use Modern::Perl;
25 use CGI qw ( -utf8 );
26 use DateTime::TimeZone;
27 use File::Spec;
28 use File::Slurp;
29 use List::MoreUtils qw/ any /;
30 use LWP::Simple;
31 use Module::Load::Conditional qw(can_load);
32 use XML::Simple;
33 use Config;
34 use Search::Elasticsearch;
35 use Try::Tiny;
36 use YAML qw/LoadFile/;
38 use C4::Output;
39 use C4::Auth;
40 use C4::Context;
41 use C4::Installer::PerlModules;
43 use Koha;
44 use Koha::DateUtils qw(dt_from_string output_pref);
45 use Koha::Acquisition::Currencies;
46 use Koha::BiblioFrameworks;
47 use Koha::Email;
48 use Koha::Patron::Categories;
49 use Koha::Patrons;
50 use Koha::Caches;
51 use Koha::Config::SysPrefs;
52 use Koha::Illrequest::Config;
53 use Koha::SearchEngine::Elasticsearch;
54 use Koha::Logger;
55 use Koha::Filter::MARC::ViewPolicy;
57 use C4::Members::Statistics;
60 #use Smart::Comments '####';
62 my $query = new CGI;
63 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
65 template_name => "about.tt",
66 query => $query,
67 type => "intranet",
68 flagsrequired => { catalogue => 1 },
69 debug => 1,
73 my $config_timezone = C4::Context->config('timezone') // '';
74 my $config_invalid = !DateTime::TimeZone->is_valid_name( $config_timezone );
75 my $env_timezone = $ENV{TZ} // '';
76 my $env_invalid = !DateTime::TimeZone->is_valid_name( $env_timezone );
77 my $actual_bad_tz_fallback = 0;
79 if ( $config_timezone ne '' &&
80 $config_invalid ) {
81 # Bad config
82 $actual_bad_tz_fallback = 1;
84 elsif ( $config_timezone eq '' &&
85 $env_timezone ne '' &&
86 $env_invalid ) {
87 # No config, but bad ENV{TZ}
88 $actual_bad_tz_fallback = 1;
91 my $time_zone = {
92 actual => C4::Context->tz->name,
93 actual_bad_tz_fallback => $actual_bad_tz_fallback,
94 config => $config_timezone,
95 config_invalid => $config_invalid,
96 environment => $env_timezone,
97 environment_invalid => $env_invalid
100 { # Logger checks
101 my $log4perl_config = C4::Context->config("log4perl_conf");
102 my @log4perl_errors;
103 if ( ! $log4perl_config ) {
104 push @log4perl_errors, 'missing_config_entry'
106 else {
107 my @lines = read_file($log4perl_config) or push @log4perl_errors, 'cannot_read_config_file';
108 for my $line ( @lines ) {
109 next unless $line =~ m|log4perl.appender.\w+.filename=(.*)|;
110 push @log4perl_errors, 'logfile_not_writable' unless -w $1;
113 eval {Koha::Logger->get};
114 push @log4perl_errors, 'cannot_init_module' and warn $@ if $@;
115 $template->param( log4perl_errors => @log4perl_errors );
118 $template->param(
119 time_zone => $time_zone,
120 current_date_and_time => output_pref({ dt => dt_from_string(), dateformat => 'iso' })
123 my $perl_path = $^X;
124 if ($^O ne 'VMS') {
125 $perl_path .= $Config{_exe} unless $perl_path =~ m/$Config{_exe}$/i;
128 my $zebraVersion = `zebraidx -V`;
130 # Check running PSGI env
131 if ( any { /(^psgi\.|^plack\.)/i } keys %ENV ) {
132 $template->param(
133 is_psgi => 1,
134 psgi_server => ($ENV{ PLACK_ENV }) ? "Plack ($ENV{PLACK_ENV})" :
135 ($ENV{ MOD_PERL }) ? "mod_perl ($ENV{MOD_PERL})" :
136 'Unknown'
140 # Memcached configuration
141 my $memcached_servers = $ENV{MEMCACHED_SERVERS} || C4::Context->config('memcached_servers');
142 my $memcached_namespace = $ENV{MEMCACHED_NAMESPACE} || C4::Context->config('memcached_namespace') // 'koha';
144 my $cache = Koha::Caches->get_instance;
145 my $effective_caching_method = ref($cache->cache);
146 # Memcached may have been running when plack has been initialized but could have been stopped since
147 # FIXME What are the consequences of that??
148 my $is_memcached_still_active = $cache->set_in_cache('test_for_about_page', "just a simple value");
150 my $where_is_memcached_config = 'nowhere';
151 if ( $ENV{MEMCACHED_SERVERS} and C4::Context->config('memcached_servers') ) {
152 $where_is_memcached_config = 'both';
153 } elsif ( $ENV{MEMCACHED_SERVERS} and not C4::Context->config('memcached_servers') ) {
154 $where_is_memcached_config = 'ENV_only';
155 } elsif ( C4::Context->config('memcached_servers') ) {
156 $where_is_memcached_config = 'config_only';
159 $template->param(
160 effective_caching_method => $effective_caching_method,
161 memcached_servers => $memcached_servers,
162 memcached_namespace => $memcached_namespace,
163 is_memcached_still_active => $is_memcached_still_active,
164 where_is_memcached_config => $where_is_memcached_config,
165 memcached_running => Koha::Caches->get_instance->memcached_cache,
168 # Additional system information for warnings
170 my $warnStatisticsFieldsError;
171 my $prefStatisticsFields = C4::Context->preference('StatisticsFields');
172 if ($prefStatisticsFields) {
173 $warnStatisticsFieldsError = $prefStatisticsFields
174 unless ( $prefStatisticsFields eq C4::Members::Statistics->get_fields() );
177 my $prefAutoCreateAuthorities = C4::Context->preference('AutoCreateAuthorities');
178 my $prefBiblioAddsAuthorities = C4::Context->preference('BiblioAddsAuthorities');
179 my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBiblioAddsAuthorities) );
181 my $prefEasyAnalyticalRecords = C4::Context->preference('EasyAnalyticalRecords');
182 my $prefUseControlNumber = C4::Context->preference('UseControlNumber');
183 my $warnPrefEasyAnalyticalRecords = ( $prefEasyAnalyticalRecords && $prefUseControlNumber );
185 my $AnonymousPatron = C4::Context->preference('AnonymousPatron');
186 my $warnPrefAnonymousPatronOPACPrivacy = (
187 C4::Context->preference('OPACPrivacy')
188 and not $AnonymousPatron
190 my $warnPrefAnonymousPatronAnonSuggestions = (
191 C4::Context->preference('AnonSuggestions')
192 and not $AnonymousPatron
195 my $anonymous_patron = Koha::Patrons->find( $AnonymousPatron );
196 my $warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist = ( $AnonymousPatron && C4::Context->preference('AnonSuggestions') && not $anonymous_patron );
198 my $warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist = ( not $anonymous_patron and Koha::Patrons->search({ privacy => 2 })->count );
200 my $warnPrefKohaAdminEmailAddress = not Email::Valid->address(C4::Context->preference('KohaAdminEmailAddress'));
202 my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode();
204 my $warnIsRootUser = (! $loggedinuser);
206 my $warnNoActiveCurrency = (! defined Koha::Acquisition::Currencies->get_active);
208 my @xml_config_warnings;
210 my $context = new C4::Context;
212 if ( C4::Context->config('zebra_bib_index_mode')
213 and C4::Context->config('zebra_bib_index_mode') eq 'grs1' )
215 push @xml_config_warnings, { error => 'zebra_bib_index_mode_is_grs1' };
218 if ( C4::Context->config('zebra_auth_index_mode')
219 and C4::Context->config('zebra_auth_index_mode') eq 'grs1' )
221 push @xml_config_warnings, { error => 'zebra_auth_index_mode_is_grs1' };
224 if( ( C4::Context->config('zebra_auth_index_mode')
225 and C4::Context->config('zebra_auth_index_mode') eq 'dom' )
226 && ( $context->{'server'}->{'authorityserver'}->{'config'} !~ /zebra-authorities-dom.cfg/ ) )
228 push @xml_config_warnings, {
229 error => 'zebra_auth_index_mode_mismatch_warn'
233 if ( ! defined C4::Context->config('log4perl_conf') ) {
234 push @xml_config_warnings, {
235 error => 'log4perl_entry_missing'
239 if ( ! defined C4::Context->config('lockdir') ) {
240 push @xml_config_warnings, {
241 error => 'lockdir_entry_missing'
244 else {
245 unless ( -w C4::Context->config('lockdir') ) {
246 push @xml_config_warnings, {
247 error => 'lockdir_not_writable',
248 lockdir => C4::Context->config('lockdir')
253 if ( ! defined C4::Context->config('upload_path') ) {
254 if ( Koha::Config::SysPrefs->find('OPACBaseURL')->value ) {
255 # OPACBaseURL seems to be set
256 push @xml_config_warnings, {
257 error => 'uploadpath_entry_missing'
259 } else {
260 push @xml_config_warnings, {
261 error => 'uploadpath_and_opacbaseurl_entry_missing'
266 if ( ! C4::Context->config('tmp_path') ) {
267 my $temporary_directory = C4::Context::temporary_directory;
268 push @xml_config_warnings, {
269 error => 'tmp_path_missing',
270 effective_tmp_dir => $temporary_directory,
274 # Test Zebra facets configuration
275 if ( !defined C4::Context->config('use_zebra_facets') ) {
276 push @xml_config_warnings, { error => 'use_zebra_facets_entry_missing' };
279 # ILL module checks
280 if ( C4::Context->preference('ILLModule') ) {
281 my $warnILLConfiguration = 0;
282 my $ill_config_from_file = C4::Context->config("interlibrary_loans");
283 my $ill_config = Koha::Illrequest::Config->new;
285 my $available_ill_backends =
286 ( scalar @{ $ill_config->available_backends } > 0 );
288 # Check backends
289 if ( !$available_ill_backends ) {
290 $template->param( no_ill_backends => 1 );
291 $warnILLConfiguration = 1;
294 # Check partner_code
295 if ( !Koha::Patron::Categories->find($ill_config->partner_code) ) {
296 $template->param( ill_partner_code_doesnt_exist => $ill_config->partner_code );
297 $warnILLConfiguration = 1;
300 if ( !$ill_config_from_file->{partner_code} ) {
301 # partner code not defined
302 $template->param( ill_partner_code_not_defined => 1 );
303 $warnILLConfiguration = 1;
307 if ( !$ill_config_from_file->{branch} ) {
308 # branch not defined
309 $template->param( ill_branch_not_defined => 1 );
310 $warnILLConfiguration = 1;
313 $template->param( warnILLConfiguration => $warnILLConfiguration );
316 if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) {
317 # Check ES configuration health and runtime status
319 my $es_status;
320 my $es_config_error;
321 my $es_running = 1;
323 my $es_conf;
324 try {
325 $es_conf = Koha::SearchEngine::Elasticsearch::_read_configuration();
327 catch {
328 if ( ref($_) eq 'Koha::Exceptions::Config::MissingEntry' ) {
329 $template->param( elasticsearch_fatal_config_error => $_->message );
330 $es_config_error = 1;
333 if ( !$es_config_error ) {
335 my $biblios_index_name = $es_conf->{index_name} . "_" . $Koha::SearchEngine::BIBLIOS_INDEX;
336 my $authorities_index_name = $es_conf->{index_name} . "_" . $Koha::SearchEngine::AUTHORITIES_INDEX;
338 my @indexes = ($biblios_index_name, $authorities_index_name);
339 # TODO: When new indexes get added, we could have other ways to
340 # fetch the list of available indexes (e.g. plugins, etc)
341 $es_status->{nodes} = $es_conf->{nodes};
342 my $es = Search::Elasticsearch->new({ nodes => $es_conf->{nodes} });
344 foreach my $index ( @indexes ) {
345 my $count;
346 try {
347 $count = $es->indices->stats( index => $index )
348 ->{_all}{primaries}{docs}{count};
350 catch {
351 if ( ref($_) eq 'Search::Elasticsearch::Error::Missing' ) {
352 push @{ $es_status->{errors} }, "Index not found ($index)";
353 $count = -1;
355 elsif ( ref($_) eq 'Search::Elasticsearch::Error::NoNodes' ) {
356 $es_running = 0;
358 else {
359 # TODO: when time comes, we will cover more use cases
360 die $_;
364 push @{ $es_status->{indexes} },
366 index_name => $index,
367 count => $count
370 $es_status->{running} = $es_running;
372 $template->param( elasticsearch_status => $es_status );
376 if ( C4::Context->preference('RESTOAuth2ClientCredentials') ) {
377 # Do we have the required deps?
378 unless ( can_load( modules => { 'Net::OAuth2::AuthorizationServer' => undef }) ) {
379 $template->param( oauth2_missing_deps => 1 );
383 # Sco Patron should not contain any other perms than circulate => self_checkout
384 if ( C4::Context->preference('WebBasedSelfCheck')
385 and C4::Context->preference('AutoSelfCheckAllowed')
387 my $userid = C4::Context->preference('AutoSelfCheckID');
388 my $all_permissions = C4::Auth::get_user_subpermissions( $userid );
389 my ( $has_self_checkout_perm, $has_other_permissions );
390 while ( my ( $module, $permissions ) = each %$all_permissions ) {
391 if ( $module eq 'self_check' ) {
392 while ( my ( $permission, $flag ) = each %$permissions ) {
393 if ( $permission eq 'self_checkout_module' ) {
394 $has_self_checkout_perm = 1;
395 } else {
396 $has_other_permissions = 1;
399 } else {
400 $has_other_permissions = 1;
403 $template->param(
404 AutoSelfCheckPatronDoesNotHaveSelfCheckPerm => not ( $has_self_checkout_perm ),
405 AutoSelfCheckPatronHasTooManyPerm => $has_other_permissions,
409 # Test YAML system preferences
410 # FIXME: This is list of current YAML formatted prefs, should by type of preference
411 my @yaml_prefs = (
412 "UpdateNotForLoanStatusOnCheckin",
413 "OpacHiddenItems",
414 "BibtexExportAdditionalFields",
415 "RisExportAdditionalFields",
416 "UpdateItemWhenLostFromHoldList",
417 "MarcFieldsToOrder",
418 "MarcItemFieldsToOrder",
419 "UpdateitemLocationOnCheckin",
420 "ItemsDeniedRenewal"
422 my @bad_yaml_prefs;
423 foreach my $syspref (@yaml_prefs) {
424 my $yaml = C4::Context->preference( $syspref );
425 if ( $yaml ) {
426 eval { YAML::Load( "$yaml\n\n" ); };
427 if ($@) {
428 push @bad_yaml_prefs, $syspref;
432 $template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs;
435 my $dbh = C4::Context->dbh;
436 my $patrons = $dbh->selectall_arrayref(
437 q|select b.borrowernumber from borrowers b join deletedborrowers db on b.borrowernumber=db.borrowernumber|,
438 { Slice => {} }
440 my $biblios = $dbh->selectall_arrayref(
441 q|select b.biblionumber from biblio b join deletedbiblio db on b.biblionumber=db.biblionumber|,
442 { Slice => {} }
444 my $items = $dbh->selectall_arrayref(
445 q|select i.itemnumber from items i join deleteditems di on i.itemnumber=di.itemnumber|,
446 { Slice => {} }
448 my $checkouts = $dbh->selectall_arrayref(
449 q|select i.issue_id from issues i join old_issues oi on i.issue_id=oi.issue_id|,
450 { Slice => {} }
452 my $holds = $dbh->selectall_arrayref(
453 q|select r.reserve_id from reserves r join old_reserves o on r.reserve_id=o.reserve_id|,
454 { Slice => {} }
456 if ( @$patrons or @$biblios or @$items or @$checkouts or @$holds ) {
457 $template->param(
458 has_ai_issues => 1,
459 ai_patrons => $patrons,
460 ai_biblios => $biblios,
461 ai_items => $items,
462 ai_checkouts => $checkouts,
463 ai_holds => $holds,
468 # Circ rule warnings
470 my $dbh = C4::Context->dbh;
471 my $units = Koha::CirculationRules->search({ rule_name => 'lengthunit', rule_value => { -not_in => ['days', 'hours'] } });
473 if ( $units->count ) {
474 $template->param(
475 warnIssuingRules => 1,
476 ir_units => $units,
481 # Guarantor relationships warnings
483 my $dbh = C4::Context->dbh;
484 my ($bad_relationships_count) = $dbh->selectall_arrayref(q{
485 SELECT COUNT(*)
486 FROM (
487 SELECT relationship FROM borrower_relationships WHERE relationship='_bad_data'
488 UNION ALL
489 SELECT relationship FROM borrowers WHERE relationship='_bad_data') a
492 $bad_relationships_count = $bad_relationships_count->[0]->[0];
494 my $existing_relationships = $dbh->selectall_arrayref(q{
495 SELECT DISTINCT(relationship)
496 FROM (
497 SELECT relationship FROM borrower_relationships WHERE relationship IS NOT NULL
498 UNION ALL
499 SELECT relationship FROM borrowers WHERE relationship IS NOT NULL) a
502 my %valid_relationships = map { $_ => 1 } split( /,|\|/, C4::Context->preference('borrowerRelationship') );
503 $valid_relationships{ _bad_data } = 1; # we handle this case in another way
505 my $wrong_relationships = [ grep { !$valid_relationships{ $_->[0] } } @{$existing_relationships} ];
506 if ( @$wrong_relationships or $bad_relationships_count ) {
508 $template->param(
509 warnRelationships => 1,
512 if ( $wrong_relationships ) {
513 $template->param(
514 wrong_relationships => $wrong_relationships
517 if ($bad_relationships_count) {
518 $template->param(
519 bad_relationships_count => $bad_relationships_count,
526 # Test 'bcrypt_settings' config for Pseudonymization
527 $template->param( config_bcrypt_settings_no_set => 1 )
528 if C4::Context->preference('Pseudonymization')
529 and not C4::Context->config('bcrypt_settings');
533 my @frameworkcodes = Koha::BiblioFrameworks->search->get_column('frameworkcode');
534 my @hidden_biblionumbers;
535 push @frameworkcodes, ""; # it's not in the biblio_frameworks table!
536 for my $frameworkcode ( @frameworkcodes ) {
537 my $shouldhidemarc_opac = Koha::Filter::MARC::ViewPolicy->should_hide_marc(
539 frameworkcode => $frameworkcode,
540 interface => "opac"
543 push @hidden_biblionumbers, { frameworkcode => $frameworkcode, interface => 'opac' }
544 if $shouldhidemarc_opac->{biblionumber};
546 my $shouldhidemarc_intranet = Koha::Filter::MARC::ViewPolicy->should_hide_marc(
548 frameworkcode => $frameworkcode,
549 interface => "intranet"
552 push @hidden_biblionumbers, { frameworkcode => $frameworkcode, interface => 'intranet' }
553 if $shouldhidemarc_intranet->{biblionumber};
555 $template->param( warnHiddenBiblionumbers => \@hidden_biblionumbers );
558 my %versions = C4::Context::get_versions();
560 $template->param(
561 kohaVersion => $versions{'kohaVersion'},
562 osVersion => $versions{'osVersion'},
563 perlPath => $perl_path,
564 perlVersion => $versions{'perlVersion'},
565 perlIncPath => [ map { perlinc => $_ }, @INC ],
566 mysqlVersion => $versions{'mysqlVersion'},
567 apacheVersion => $versions{'apacheVersion'},
568 zebraVersion => $zebraVersion,
569 prefBiblioAddsAuthorities => $prefBiblioAddsAuthorities,
570 prefAutoCreateAuthorities => $prefAutoCreateAuthorities,
571 warnPrefBiblioAddsAuthorities => $warnPrefBiblioAddsAuthorities,
572 warnPrefEasyAnalyticalRecords => $warnPrefEasyAnalyticalRecords,
573 warnPrefAnonymousPatronOPACPrivacy => $warnPrefAnonymousPatronOPACPrivacy,
574 warnPrefAnonymousPatronAnonSuggestions => $warnPrefAnonymousPatronAnonSuggestions,
575 warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist => $warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist,
576 warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist => $warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist,
577 warnPrefKohaAdminEmailAddress => $warnPrefKohaAdminEmailAddress,
578 errZebraConnection => $errZebraConnection,
579 warnIsRootUser => $warnIsRootUser,
580 warnNoActiveCurrency => $warnNoActiveCurrency,
581 warnNoTemplateCaching => ( C4::Context->config('template_cache_dir') ? 0 : 1 ),
582 xml_config_warnings => \@xml_config_warnings,
583 warnStatisticsFieldsError => $warnStatisticsFieldsError,
586 my @components = ();
588 my $perl_modules = C4::Installer::PerlModules->new;
589 $perl_modules->versions_info;
591 my @pm_types = qw(missing_pm upgrade_pm current_pm);
593 foreach my $pm_type(@pm_types) {
594 my $modules = $perl_modules->get_attr($pm_type);
595 foreach (@$modules) {
596 my ($module, $stats) = each %$_;
597 push(
598 @components,
600 name => $module,
601 version => $stats->{'cur_ver'},
602 missing => ($pm_type eq 'missing_pm' ? 1 : 0),
603 upgrade => ($pm_type eq 'upgrade_pm' ? 1 : 0),
604 current => ($pm_type eq 'current_pm' ? 1 : 0),
605 require => $stats->{'required'},
606 reqversion => $stats->{'min_ver'},
607 maxversion => $stats->{'max_ver'},
608 excversion => $stats->{'exc_ver'}
614 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
616 my $counter=0;
617 my $row = [];
618 my $table = [];
619 foreach (@components) {
620 push (@$row, $_);
621 unless (++$counter % 4) {
622 push (@$table, {row => $row});
623 $row = [];
626 # Processing the last line (if there are any modules left)
627 if (scalar(@$row) > 0) {
628 # Extending $row to the table size
629 $$row[3] = '';
630 # Pushing the last line
631 push (@$table, {row => $row});
633 ## ## $table
635 $template->param( table => $table );
638 ## ------------------------------------------
639 ## Koha contributions
640 my $docdir;
641 if ( defined C4::Context->config('docdir') ) {
642 $docdir = C4::Context->config('docdir');
643 } else {
644 # if no <docdir> is defined in koha-conf.xml, use the default location
645 # this is a work-around to stop breakage on upgraded Kohas, bug 8911
646 $docdir = C4::Context->config('intranetdir') . '/docs';
649 ## Release teams
650 my $teams =
651 -e "$docdir" . "/teams.yaml"
652 ? LoadFile( "$docdir" . "/teams.yaml" )
653 : {};
654 my $dev_team = (sort {$b <=> $a} (keys %{$teams->{team}}))[0];
655 my $short_version = substr($versions{'kohaVersion'},0,5);
656 my $minor = substr($versions{'kohaVersion'},3,2);
657 my $development_version = ( $minor eq '05' || $minor eq '11' ) ? 0 : 1;
658 $template->param( short_version => $short_version );
659 $template->param( development_version => $development_version );
661 ## Contributors
662 my $contributors =
663 -e "$docdir" . "/contributors.yaml"
664 ? LoadFile( "$docdir" . "/contributors.yaml" )
665 : {};
666 for my $version ( sort { $a <=> $b } keys %{$teams->{team}} ) {
667 for my $role ( keys %{ $teams->{team}->{$version} } ) {
668 my $normalized_role = "$role";
669 $normalized_role =~ s/s$//;
670 if ( ref( $teams->{team}->{$version}->{$role} ) eq 'ARRAY' ) {
671 for my $contributor ( @{ $teams->{team}->{$version}->{$role} } ) {
672 my $name = $contributor->{name};
673 # Add role to contributors
674 push @{ $contributors->{$name}->{roles}->{$normalized_role} },
675 $version;
676 # Add openhub to teams
677 if ( exists( $contributors->{$name}->{openhub} ) ) {
678 $contributor->{openhub} = $contributors->{$name}->{openhub};
682 elsif ( $role ne 'release_date' ) {
683 my $name = $teams->{team}->{$version}->{$role}->{name};
684 # Add role to contributors
685 push @{ $contributors->{$name}->{roles}->{$normalized_role} },
686 $version;
687 # Add openhub to teams
688 if ( exists( $contributors->{$name}->{openhub} ) ) {
689 $teams->{team}->{$version}->{$role}->{openhub} =
690 $contributors->{$name}->{openhub};
693 else {
694 $teams->{team}->{$version}->{$role} = DateTime->from_epoch( epoch => $teams->{team}->{$version}->{$role});
699 ## Create last name ordered array of people from contributors
700 my @people = map {
701 { name => $_, ( $contributors->{$_} ? %{ $contributors->{$_} } : () ) }
702 } sort {
703 my ($alast) = ( split( /\s/, $a ) )[-1];
704 my ($blast) = ( split( /\s/, $b ) )[-1];
705 lc($alast) cmp lc($blast)
706 } keys %{$contributors};
708 $template->param( contributors => \@people );
709 $template->param( maintenance_team => $teams->{team}->{$dev_team} );
710 $template->param( release_team => $teams->{team}->{$short_version} );
712 ## Timeline
713 if ( open( my $file, "<:encoding(UTF-8)", "$docdir" . "/history.txt" ) ) {
715 my $i = 0;
717 my @rows2 = ();
718 my $row2 = [];
720 my @lines = <$file>;
721 close($file);
723 shift @lines; #remove header row
725 foreach (@lines) {
726 my ( $epoch, $date, $desc, $tag ) = split(/\t/);
727 if(!$desc && $date=~ /(?<=\d{4})\s+/) {
728 ($date, $desc)= ($`, $');
730 push(
731 @rows2,
733 date => $date,
734 desc => $desc,
739 my $table2 = [];
740 #foreach my $row2 (@rows2) {
741 foreach (@rows2) {
742 push (@$row2, $_);
743 push( @$table2, { row2 => $row2 } );
744 $row2 = [];
747 $template->param( table2 => $table2 );
748 } else {
749 $template->param( timeline_read_error => 1 );
752 output_html_with_http_headers $query, $cookie, $template->output;