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 413-418
elsif ( $step && $step == 3 ) {
Link Here
|
413 |
my $fh; |
414 |
my $fh; |
414 |
open( $fh, "<:encoding(utf-8)", $logfilepath ) |
415 |
open( $fh, "<:encoding(utf-8)", $logfilepath ) |
415 |
or die "Cannot open log file $logfilepath: $!"; |
416 |
or die "Cannot open log file $logfilepath: $!"; |
|
|
417 |
|
416 |
my @report = <$fh>; |
418 |
my @report = <$fh>; |
417 |
close $fh; |
419 |
close $fh; |
418 |
if (@report) { |
420 |
if (@report) { |
Lines 449-454
elsif ( $step && $step == 3 ) {
Link Here
|
449 |
my $atomic_update_files = get_atomic_updates; |
451 |
my $atomic_update_files = get_atomic_updates; |
450 |
my $atomic_update_report = run_atomic_updates( $atomic_update_files ); |
452 |
my $atomic_update_report = run_atomic_updates( $atomic_update_files ); |
451 |
|
453 |
|
|
|
454 |
colorize($report); |
455 |
colorize($atomic_update_report); |
452 |
$template->param( |
456 |
$template->param( |
453 |
success => $report->{success}, |
457 |
success => $report->{success}, |
454 |
error => $report->{error}, |
458 |
error => $report->{error}, |
Lines 550-552
sub chk_log { #returns a logfile in $dir or - if that failed - in temp dir
Link Here
|
550 |
} |
554 |
} |
551 |
return $fn; |
555 |
return $fn; |
552 |
} |
556 |
} |
|
|
557 |
|
558 |
sub colorize { |
559 |
my ($report) = @_; |
560 |
my $h = HTML::FromANSI::Tiny->new( |
561 |
auto_reverse => 0, background => 'white', foreground => 'black', |
562 |
inline_style => 1, no_plain_tags => 1 |
563 |
); |
564 |
|
565 |
my @states = ( 'success', 'error' ); |
566 |
for my $state (@states) { |
567 |
for my $result ( @{ $report->{$state} } ) { |
568 |
#@{ $result->{output} } = map { s/^\t+//; $h->html($_) } @{ $result->{output} }; |
569 |
for my $output ( @{ $result->{output} } ) { |
570 |
$output = $h->html($output); |
571 |
} |
572 |
} |
573 |
} |
574 |
} |