]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 893589 - 004template.t fails when templates in extension directory
authorSimon Green <sgreen@redhat.com>
Thu, 26 Sep 2013 02:20:02 +0000 (12:20 +1000)
committerSimon Green <sgreen@redhat.com>
Thu, 26 Sep 2013 02:20:02 +0000 (12:20 +1000)
r=dkl, a=simon

t/004template.t
t/Support/Files.pm
t/Support/Templates.pm

index c81bccc45ba36744a9550bcca777636da6101cd2..298bb52c06e0a46bdf758197c02d1559c9ac2dc8 100644 (file)
@@ -37,17 +37,21 @@ my $fh;
 }
 
 # Check to make sure all templates that are referenced in Bugzilla
-# exist in the proper place in the English template directory.
+# exist in the proper place in the English template or extension directory.
 # All other languages may or may not include any template as Bugzilla will
 # fall back to English if necessary.
 
 foreach my $file (@referenced_files) {
-    my $path = File::Spec->catfile($english_default_include_path, $file);
-    if (-e $path) {
-        ok(1, "$path exists");
-    } else {
-        ok(0, "$path cannot be located --ERROR");
+    my $found = 0;
+    foreach my $path (@english_default_include_paths) {
+        my $pathfile = File::Spec->catfile($path, $file);
+        if (-e $pathfile) {
+            $found = 1;
+            last;
+        }
     }
+
+    ok($found, "$file found");
 }
 
 foreach my $include_path (@include_paths) {
index ed011a374c58daadb40761e2250378b483184a01..330a473b1ff465f5e2348046315ca2db4b080af2 100644 (file)
@@ -16,11 +16,11 @@ use File::Find;
 find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, 'Bugzilla');
 push(@files, 'extensions/create.pl');
 
-my @extensions = glob('extensions/*');
-foreach my $extension (@extensions) {
-    # Skip disabled extensions
-    next if -e "$extension/disabled";
+@extensions =
+    grep { $_ ne 'extensions/create.pl' && ! -e "$_/disabled" }
+    glob('extensions/*');
 
+foreach my $extension (@extensions) {
     find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, $extension);
 }
 
index c9a528e9f900900d13e5d6d170379027bb46a8aa..2185d687f9f6b7d1836492f2ce277861e88abbfa 100644 (file)
@@ -12,9 +12,9 @@ use strict;
 use lib 't';
 use parent qw(Exporter);
 @Support::Templates::EXPORT = 
-         qw(@languages @include_paths $english_default_include_path
+         qw(@languages @include_paths @english_default_include_paths
          %include_path @referenced_files %actual_files $num_actual_files);
-use vars qw(@languages @include_paths $english_default_include_path
+use vars qw(@languages @include_paths @english_default_include_paths
             %include_path @referenced_files %actual_files $num_actual_files);
 
 use Bugzilla;
@@ -34,10 +34,18 @@ use File::Spec;
 # All include paths
 @include_paths = ();
 
-# English default include path
-$english_default_include_path =
+# English default include paths
+push @english_default_include_paths,
     File::Spec->catdir(bz_locations()->{'templatedir'}, 'en', 'default');
 
+# And the extensions too
+foreach my $extension (@Support::Files::extensions) {
+    my $dir = File::Spec->catdir($extension, 'template', 'en', 'default');
+    if (-e $dir) {
+        push @english_default_include_paths, $dir;
+    }
+}
+
 # Files which are referenced in the cgi files
 @referenced_files = ();