Bug 15395: Do not process template files that do not use i18n.inc

It should make the string extraction process a little faster

For the record, I timed some parts of the process to see why it was so
slow, and without surprises the most time-consuming task is the Perl
code analysis by PPI with an average time of 50ms by "template block" on
my machine.
Multiply that by the number of template blocks (approximatively 900),
that gives us 45 seconds just for this task.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Julian Maurice 2018-10-25 15:04:46 +02:00 committed by Nick Clemens
parent d1c6e70b44
commit ee0c8f319a

View file

@ -527,6 +527,10 @@ sub extract_messages_from_templates {
foreach my $file (@files) {
say "Extract messages from $file" if $self->{verbose};
my $template = read_file("$intranetdir/$file");
# No need to process a file that doesn't use the i18n.inc file.
next unless $template =~ /i18n\.inc/;
my $data = $parser->parse($template);
unless ($data) {
warn "Error at $file : " . $parser->error();