Bugzilla – Attachment 159472 Details for
Bug 34862
blocking_errors.inc not included everywhere
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34862: [DO NOT PUSH] add script
Bug-34862-DO-NOT-PUSH-add-script.patch (text/plain), 2.21 KB, created by
Kyle M Hall (khall)
on 2023-12-01 17:57:57 UTC
(
hide
)
Description:
Bug 34862: [DO NOT PUSH] add script
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2023-12-01 17:57:57 UTC
Size:
2.21 KB
patch
obsolete
>From 8fb0cdc6e4c27ef69c33c2f7d129b26d375fff43 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 21 Sep 2023 14:40:26 +0200 >Subject: [PATCH] Bug 34862: [DO NOT PUSH] add script > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > add_blocking_errors.pl | 60 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 60 insertions(+) > create mode 100644 add_blocking_errors.pl > >diff --git a/add_blocking_errors.pl b/add_blocking_errors.pl >new file mode 100644 >index 00000000000..048bef3d4bf >--- /dev/null >+++ b/add_blocking_errors.pl >@@ -0,0 +1,60 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+use File::Find; >+use File::Slurp; >+use Data::Dumper; >+ >+my @themes; >+ >+# STAFF themes >+my $staff_dir = 'koha-tmpl/intranet-tmpl'; >+opendir ( my $dh, $staff_dir ) or die "can't opendir $staff_dir: $!"; >+for my $theme ( grep { not /^\.|lib|js/ } readdir($dh) ) { >+ push @themes, "$staff_dir/$theme/en"; >+} >+close $dh; >+ >+my @files; >+sub wanted { >+ my $name = $File::Find::name; >+ push @files, $name >+ if $name =~ m[\.(tt)$] and -f $name; >+} >+ >+find({ wanted => \&wanted, no_chdir => 1 }, @themes ); >+ >+my @errors; >+for my $file ( @files ) { >+ add_messages($file); >+} >+ >+sub add_messages { >+ my ( $file ) = @_; >+ >+ my $messages_include = "[% INCLUDE 'messages.inc' %]\n"; >+ my @lines = read_file($file); >+ my @new_lines = @lines; >+ my $has_main_tag = grep { $_ =~ m|<main| } @lines; >+ my $spacing = q{}; >+ my ( $in_main, $line_open_main ); >+ my ( $line_number, $number_replaced_mains ) = (0, 0); >+ for my $line (@lines) { >+ $line_number++; >+ if ( $line =~ m{^(\s*)<main} ) { >+ $spacing = $1 . " "; >+ $in_main = 1; >+ $line_open_main = $line_number; >+ } elsif (!$has_main_tag && $line =~ m{(\s*)<div class="main} ) { >+ $spacing = $1 . " "; >+ $in_main = 1; >+ $line_open_main = $line_number + 2; >+ } >+ if ( $in_main ) { >+ splice @new_lines, $line_open_main + $number_replaced_mains, 0, $spacing . $messages_include; >+ $number_replaced_mains++; >+ $in_main = 0; >+ } >+ } >+ write_file($file, @new_lines); >+} >-- >2.30.2
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 34862
:
155991
|
155992
|
155993
|
155997
|
155998
|
155999
|
156000
|
158755
|
158756
|
158757
|
158758
|
158759
|
159472
|
159473
|
159474
|
159475
|
159476
|
159477
|
161666
|
161667
|
161668
|
161669
|
161670
|
161671
|
161672
|
161673
|
161674
|
161675
|
161676
|
161677
|
161678