Lines 23-28
use diagnostics;
Link Here
|
23 |
use C4::InstallAuth qw( get_template_and_user ); |
23 |
use C4::InstallAuth qw( get_template_and_user ); |
24 |
use CGI qw ( -utf8 ); |
24 |
use CGI qw ( -utf8 ); |
25 |
use POSIX; |
25 |
use POSIX; |
|
|
26 |
use HTML::FromANSI::Tiny; |
26 |
|
27 |
|
27 |
use C4::Context; |
28 |
use C4::Context; |
28 |
use C4::Output qw( output_html_with_http_headers ); |
29 |
use C4::Output qw( output_html_with_http_headers ); |
Lines 420-425
elsif ( $step && $step == 3 ) {
Link Here
|
420 |
my $fh; |
421 |
my $fh; |
421 |
open( $fh, "<:encoding(utf-8)", $logfilepath ) |
422 |
open( $fh, "<:encoding(utf-8)", $logfilepath ) |
422 |
or die "Cannot open log file $logfilepath: $!"; |
423 |
or die "Cannot open log file $logfilepath: $!"; |
|
|
424 |
|
423 |
my @report = <$fh>; |
425 |
my @report = <$fh>; |
424 |
close $fh; |
426 |
close $fh; |
425 |
if (@report) { |
427 |
if (@report) { |
Lines 456-461
elsif ( $step && $step == 3 ) {
Link Here
|
456 |
my $atomic_update_files = get_atomic_updates; |
458 |
my $atomic_update_files = get_atomic_updates; |
457 |
my $atomic_update_report = run_atomic_updates( $atomic_update_files ); |
459 |
my $atomic_update_report = run_atomic_updates( $atomic_update_files ); |
458 |
|
460 |
|
|
|
461 |
colorize($report); |
462 |
colorize($atomic_update_report); |
459 |
$template->param( |
463 |
$template->param( |
460 |
success => $report->{success}, |
464 |
success => $report->{success}, |
461 |
error => $report->{error}, |
465 |
error => $report->{error}, |
Lines 561-563
sub chk_log { #returns a logfile in $dir or - if that failed - in temp dir
Link Here
|
561 |
} |
565 |
} |
562 |
return $fn; |
566 |
return $fn; |
563 |
} |
567 |
} |
|
|
568 |
|
569 |
sub colorize { |
570 |
my ($report) = @_; |
571 |
my $h = HTML::FromANSI::Tiny->new( |
572 |
auto_reverse => 0, background => 'white', foreground => 'black', |
573 |
inline_style => 1, no_plain_tags => 1 |
574 |
); |
575 |
|
576 |
my @states = ( 'success', 'error' ); |
577 |
for my $state (@states) { |
578 |
for my $result ( @{ $report->{$state} } ) { |
579 |
#@{ $result->{output} } = map { s/^\t+//; $h->html($_) } @{ $result->{output} }; |
580 |
for my $output ( @{ $result->{output} } ) { |
581 |
$output = $h->html($output); |
582 |
} |
583 |
} |
584 |
} |
585 |
} |