Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2fa8942d

Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt

  • ID 2fa8942d6454f4af65759b57f706f3731a88e46c
  • Vorgänger f704c1f4
  • Nachfolger 36a9840b

Untersuchung von HTML-Vorlagen, ob sie bestimmte Plugins benutzen, diese aber nicht laden.

Unterschiede anzeigen:

locale/de/locales.pl
10 10
use FileHandle;
11 11
use Data::Dumper;
12 12

  
13
use List::Util qw(first);
14

  
13 15
$| = 1;
14 16

  
15 17
$basedir  = "../..";
......
481 483

  
482 484
sub scanhtmlfile {
483 485
  local *IN;
484
 
486

  
485 487
  if (!defined $cached{$_[0]}) {
486
 
488
    my %plugins = ( 'loaded' => { }, 'needed' => { } );
489

  
487 490
    open(IN, $_[0]) || die $_[0];
488 491

  
489 492
    my $copying = 0;
......
492 495
    while (my $line = <IN>) {
493 496
      chomp($line);
494 497

  
498
      while ($line =~ m/\[\%[^\w]*use[^\w]+(\w+)[^\w]*?\%\]/gi) {
499
        $plugins{loaded}->{$1} = 1;
500
      }
501

  
502
      while ($line =~ m/\[\%[^\w]*(\w+)\.\w+\(/g) {
503
        my $plugin = $1;
504
        $plugins{needed}->{$plugin} = 1 if (first { $_ eq $plugin } qw(HTML LxERP JavaScript MultiColumnIterator));
505
      }
506

  
495 507
      while ("" ne $line) {
496 508
        if (!$copying) {
497 509
          if ($line =~ m|<translate>|i) {
......
532 544
    }
533 545

  
534 546
    close(IN);
547

  
548
    foreach my $plugin (keys %{ $plugins{needed} }) {
549
      next if ($plugins{loaded}->{$plugin});
550
      print "E: " . strip_base($_[0]) . " requires the Template plugin '$plugin', but is not loaded with '[\% USE $plugin \%]'.\n";
551
    }
552

  
535 553
    &converthtmlfile($_[0]);
536 554
  }
537 555

  

Auch abrufbar als: Unified diff