Bug 893589 - 004template.t fails when templates in extension directory
r=dkl, a=simon git-svn-id: svn://10.0.0.236/trunk@265035 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
153f419c69
commit
1a2043e408
@ -1 +1 @@
|
|||||||
8756
|
8757
|
||||||
@ -37,17 +37,21 @@ my $fh;
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Check to make sure all templates that are referenced in Bugzilla
|
# 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
|
# All other languages may or may not include any template as Bugzilla will
|
||||||
# fall back to English if necessary.
|
# fall back to English if necessary.
|
||||||
|
|
||||||
foreach my $file (@referenced_files) {
|
foreach my $file (@referenced_files) {
|
||||||
my $path = File::Spec->catfile($english_default_include_path, $file);
|
my $found = 0;
|
||||||
if (-e $path) {
|
foreach my $path (@english_default_include_paths) {
|
||||||
ok(1, "$path exists");
|
my $pathfile = File::Spec->catfile($path, $file);
|
||||||
} else {
|
if (-e $pathfile) {
|
||||||
ok(0, "$path cannot be located --ERROR");
|
$found = 1;
|
||||||
|
last;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ok($found, "$file found");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $include_path (@include_paths) {
|
foreach my $include_path (@include_paths) {
|
||||||
|
|||||||
@ -16,11 +16,11 @@ use File::Find;
|
|||||||
find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, 'Bugzilla');
|
find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, 'Bugzilla');
|
||||||
push(@files, 'extensions/create.pl');
|
push(@files, 'extensions/create.pl');
|
||||||
|
|
||||||
my @extensions = glob('extensions/*');
|
@extensions =
|
||||||
foreach my $extension (@extensions) {
|
grep { $_ ne 'extensions/create.pl' && ! -e "$_/disabled" }
|
||||||
# Skip disabled extensions
|
glob('extensions/*');
|
||||||
next if -e "$extension/disabled";
|
|
||||||
|
|
||||||
|
foreach my $extension (@extensions) {
|
||||||
find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, $extension);
|
find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, $extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,9 +12,9 @@ use strict;
|
|||||||
use lib 't';
|
use lib 't';
|
||||||
use parent qw(Exporter);
|
use parent qw(Exporter);
|
||||||
@Support::Templates::EXPORT =
|
@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);
|
%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);
|
%include_path @referenced_files %actual_files $num_actual_files);
|
||||||
|
|
||||||
use Bugzilla;
|
use Bugzilla;
|
||||||
@ -34,10 +34,18 @@ use File::Spec;
|
|||||||
# All include paths
|
# All include paths
|
||||||
@include_paths = ();
|
@include_paths = ();
|
||||||
|
|
||||||
# English default include path
|
# English default include paths
|
||||||
$english_default_include_path =
|
push @english_default_include_paths,
|
||||||
File::Spec->catdir(bz_locations()->{'templatedir'}, 'en', 'default');
|
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
|
# Files which are referenced in the cgi files
|
||||||
@referenced_files = ();
|
@referenced_files = ();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user