From 2fa8942d6454f4af65759b57f706f3731a88e46c Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 24 Jan 2008 14:49:13 +0000 Subject: [PATCH] Untersuchung von HTML-Vorlagen, ob sie bestimmte Plugins benutzen, diese aber nicht laden. --- locale/de/locales.pl | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/locale/de/locales.pl b/locale/de/locales.pl index d876ddc57..b6ef75cd7 100755 --- a/locale/de/locales.pl +++ b/locale/de/locales.pl @@ -10,6 +10,8 @@ use POSIX; use FileHandle; use Data::Dumper; +use List::Util qw(first); + $| = 1; $basedir = "../.."; @@ -481,9 +483,10 @@ sub scanmenu { sub scanhtmlfile { local *IN; - + if (!defined $cached{$_[0]}) { - + my %plugins = ( 'loaded' => { }, 'needed' => { } ); + open(IN, $_[0]) || die $_[0]; my $copying = 0; @@ -492,6 +495,15 @@ sub scanhtmlfile { while (my $line = ) { chomp($line); + while ($line =~ m/\[\%[^\w]*use[^\w]+(\w+)[^\w]*?\%\]/gi) { + $plugins{loaded}->{$1} = 1; + } + + while ($line =~ m/\[\%[^\w]*(\w+)\.\w+\(/g) { + my $plugin = $1; + $plugins{needed}->{$plugin} = 1 if (first { $_ eq $plugin } qw(HTML LxERP JavaScript MultiColumnIterator)); + } + while ("" ne $line) { if (!$copying) { if ($line =~ m||i) { @@ -532,6 +544,12 @@ sub scanhtmlfile { } close(IN); + + foreach my $plugin (keys %{ $plugins{needed} }) { + next if ($plugins{loaded}->{$plugin}); + print "E: " . strip_base($_[0]) . " requires the Template plugin '$plugin', but is not loaded with '[\% USE $plugin \%]'.\n"; + } + &converthtmlfile($_[0]); } -- 2.20.1