diff options
author | wurblzap%gmail.com <> | 2005-11-20 09:00:05 +0100 |
---|---|---|
committer | wurblzap%gmail.com <> | 2005-11-20 09:00:05 +0100 |
commit | 5ad7900f7b12f1b81bdc068282b7106be8aae407 (patch) | |
tree | d6b03bfb1937aedfbe89020b2e025b3f379621aa /checksetup.pl | |
parent | 8b18b7e15dd23f7829c47376f33be613ca7bc977 (diff) | |
download | bugzilla-5ad7900f7b12f1b81bdc068282b7106be8aae407.tar.gz bugzilla-5ad7900f7b12f1b81bdc068282b7106be8aae407.tar.xz |
Bug 304417: Template precompilation is clumsy when it comes to additional language directories.
Patch by Jochen Wiedmann <jochen.wiedmann@gmail.com>,
r=wurblzap, a=myk
Diffstat (limited to 'checksetup.pl')
-rwxr-xr-x | checksetup.pl | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/checksetup.pl b/checksetup.pl index 3f378efd7..fda31b1cc 100755 --- a/checksetup.pl +++ b/checksetup.pl @@ -1220,27 +1220,6 @@ unless ($switch{'no_templates'}) { } } - # Search for template directories - # We include the default and custom directories separately to make - # sure we compile all templates - my @templatepaths = (); - { - use File::Spec; - opendir(DIR, $templatedir) || die "Can't open '$templatedir': $!"; - my @files = grep { /^[a-z-]+$/i } readdir(DIR); - closedir DIR; - - foreach my $dir (@files) { - next if($dir =~ /^CVS$/i); - my $path = File::Spec->catdir($templatedir, $dir, 'custom'); - push(@templatepaths, $path) if(-d $path); - $path = File::Spec->catdir($templatedir, $dir, 'extension'); - push(@templatepaths, $path) if(-d $path); - $path = File::Spec->catdir($templatedir, $dir, 'default'); - push(@templatepaths, $path) if(-d $path); - } - } - # Precompile stuff. This speeds up initial access (so the template isn't # compiled multiple times simultaneously by different servers), and helps # to get the permissions right. @@ -1267,12 +1246,25 @@ unless ($switch{'no_templates'}) { # Don't hang on templates which use the CGI library eval("use CGI qw(-no_debug)"); - $::template = Bugzilla::Template->create(); + + use File::Spec; + opendir(DIR, $templatedir) || die "Can't open '$templatedir': $!"; + my @files = grep { /^[a-z-]+$/i } readdir(DIR); + closedir DIR; - foreach $::templatepath (@templatepaths) { - # Traverse the template hierarchy. - find({ wanted => \&compile, no_chdir => 1 }, $::templatepath); - } + foreach my $dir (@files) { + next if($dir =~ /^CVS$/i); + local $ENV{'HTTP_ACCEPT_LANGUAGE'} = $dir; + SetParam("languages", "$dir,en"); + $::template = Bugzilla::Template->create(clean_cache => 1); + my @templatepaths; + foreach my $subdir (qw(custom extension default)) { + $::templatepath = File::Spec->catdir($templatedir, $dir, $subdir); + next unless -d $::templatepath; + # Traverse the template hierarchy. + find({ wanted => \&compile, no_chdir => 1 }, $::templatepath); + } + } } } |