Bugzilla – Attachment 160440 Details for
Bug 35681
Add support for colored messages in the output of updatedatabase
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35681: Allow for ANSI color in database updates
Bug-35681-Allow-for-ANSI-color-in-database-updates.patch (text/plain), 4.55 KB, created by
Martin Renvoize (ashimema)
on 2024-01-02 20:54:57 UTC
(
hide
)
Description:
Bug 35681: Allow for ANSI color in database updates
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-01-02 20:54:57 UTC
Size:
4.55 KB
patch
obsolete
>From 8ebcdf20300f4a9fbce2626c9db1fe79eff86e1c Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 2 Jan 2024 15:56:12 +0000 >Subject: [PATCH] Bug 35681: Allow for ANSI color in database updates > >This patch adds support for colored output in database updates. >--- > installer/install.pl | 19 +++++++++++++++++++ > .../prog/en/modules/installer/step3.tt | 8 ++++---- > 2 files changed, 23 insertions(+), 4 deletions(-) > >diff --git a/installer/install.pl b/installer/install.pl >index 8f53d212a2a..0fbb4214f93 100755 >--- a/installer/install.pl >+++ b/installer/install.pl >@@ -23,6 +23,7 @@ use diagnostics; > use C4::InstallAuth qw( get_template_and_user ); > use CGI qw ( -utf8 ); > use POSIX; >+use HTML::FromANSI::Tiny; > > use C4::Context; > use C4::Output qw( output_html_with_http_headers ); >@@ -413,6 +414,7 @@ elsif ( $step && $step == 3 ) { > my $fh; > open( $fh, "<:encoding(utf-8)", $logfilepath ) > or die "Cannot open log file $logfilepath: $!"; >+ > my @report = <$fh>; > close $fh; > if (@report) { >@@ -449,6 +451,23 @@ elsif ( $step && $step == 3 ) { > my $atomic_update_files = get_atomic_updates; > my $atomic_update_report = run_atomic_updates( $atomic_update_files ); > >+ my $h = HTML::FromANSI::Tiny->new( >+ auto_reverse => 1, background => 'white', foreground => 'black', >+ inline_style => 1, no_plain_tags => 1 >+ ); >+ for my $success ( @{ $report->{success} } ) { >+ @{ $success->{output} } = map { $h->html($_) } @{ $success->{output} }; >+ } >+ for my $error ( @{ $report->{error} } ) { >+ @{ $error->{output} } = map { $h->html($_) } @{ $error->{output} }; >+ } >+ for my $success ( @{ $atomic_update_report->{success} } ) { >+ @{ $success->{output} } = map { $h->html($_) } @{ $success->{output} }; >+ } >+ for my $error ( @{ $atomic_update_report->{error} } ) { >+ @{ $error->{output} } = map { $h->html($_) } @{ $error->{output} }; >+ } >+ > $template->param( > success => $report->{success}, > error => $report->{error}, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt >index 3198cddd9d4..7c95b6e4147 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt >@@ -367,7 +367,7 @@ > <ul> > [% FOR s IN success %] > [% FOR o IN s.output %] >- <li>[% o | html %]</li> >+ <li>[% o | $raw %]</li> > [% IF s.output.size > 1 %] > [% IF loop.first %]<ul>[% ELSIF loop.last %]</ul>[% END %] > [% END %] >@@ -381,7 +381,7 @@ > <ul> > [% FOR s IN atomic_updates.success %] > [% FOR o IN s.output %] >- <li>[% o | html %]</li> >+ <li>[% o | $raw %]</lia > [% IF s.output.size > 1 %] > [% IF loop.first %]<ul>[% ELSIF loop.last %]</ul>[% END %] > [% END %] >@@ -409,7 +409,7 @@ > <li class="update_error"> > [% o | html %] > <br/> >- ERROR: [% e.error | html %] >+ ERROR: [% e.error | $raw %] > > [% IF e.output.size > 1 %] > [% IF loop.first %]<ul>[% ELSIF loop.last %]</ul>[% END %] >@@ -429,7 +429,7 @@ > <li class="update_error"> > [% o | html %] > <br/> >- ERROR: [% e.error | html %] >+ ERROR: [% e.error | $raw %] > > [% IF e.output.size > 1 %] > [% IF loop.first %]<ul>[% ELSIF loop.last %]</ul>[% END %] >-- >2.43.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35681
:
160439
|
160440
|
160443
|
160444
|
160445
|
160447
|
160448
|
160449
|
160473
|
160503
|
160504
|
160505
|
160506
|
160750
|
160751
|
160772
|
164903
|
164904
|
164905
|
164906
|
164907
|
164908
|
164909
|
164942
|
164943
|
164944
|
164945
|
164946
|
164947
|
164948
|
164949