summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgerv%gerv.net <>2005-04-05 07:29:07 +0200
committergerv%gerv.net <>2005-04-05 07:29:07 +0200
commitc344d90a763065f45b268fab325f2bb4f154b878 (patch)
treeabdce06046a6413c0e2f1b2386d7dd9b93e0c522
parent6f31547ef949153e4ee591b28eec95dcf8bd5525 (diff)
downloadbugzilla-c344d90a763065f45b268fab325f2bb4f154b878.tar.gz
bugzilla-c344d90a763065f45b268fab325f2bb4f154b878.tar.xz
Bug 288527 - change precompilation to use Bugzilla::Template and so do it right. Patch by gerv; r=bbaetz, a=justdave.
-rw-r--r--Bugzilla/Template.pm3
-rwxr-xr-xchecksetup.pl47
2 files changed, 8 insertions, 42 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 29ed2924c..23a9c0a7c 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -218,8 +218,7 @@ sub create {
# Functions for processing text within templates in various ways.
# IMPORTANT! When adding a filter here that does not override a
- # built-in filter, please also add a stub filter to checksetup.pl
- # and t/004template.t.
+ # built-in filter, please also add a stub filter to t/004template.t.
FILTERS => {
# Render text in required style.
diff --git a/checksetup.pl b/checksetup.pl
index c46bcfec9..0e2af1608 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -1201,9 +1201,9 @@ unless ($switch{'no_templates'}) {
return if ($name !~ /\.tmpl$/);
$name =~ s/\Q$::templatepath\E\///; # trim the bit we don't pass to TT
- # Do this to avoid actually processing the templates
- my ($data, $err) = $::provider->fetch($name);
- die "Could not compile $name: " . $data . "\n" if $err;
+ # Compile the template but throw away the result. This has the side-
+ # effect of writing the compiled version to disk.
+ $::template->context()->template($name);
}
eval("use Template");
@@ -1212,46 +1212,13 @@ unless ($switch{'no_templates'}) {
print "Precompiling templates ...\n" unless $silent;
use File::Find;
-
+ require Bugzilla::Template;
+
# Don't hang on templates which use the CGI library
eval("use CGI qw(-no_debug)");
- foreach $::templatepath (@templatepaths) {
- $::provider = Template::Provider->new(
- {
- # Directories containing templates.
- INCLUDE_PATH => $::templatepath,
-
- PRE_CHOMP => 1 ,
- TRIM => 1 ,
-
- # => $datadir/template/`pwd`/template/{en, ...}/{custom,default}
- COMPILE_DIR => "$datadir/template",
-
- # Initialize templates (f.e. by loading plugins like Hook).
- PRE_PROCESS => "global/initialize.none.tmpl",
-
- # These don't actually need to do anything here, just exist
- FILTERS =>
- {
- inactive => sub { return $_; } ,
- closed => sub { return $_; },
- obsolete => sub { return $_; },
- js => sub { return $_; },
- html_linebreak => sub { return $_; },
- no_break => sub { return $_; },
- url_quote => sub { return $_; },
- xml => sub { return $_; },
- quoteUrls => sub { return $_; },
- bug_link => [ sub { return sub { return $_; } }, 1],
- csv => sub { return $_; },
- unitconvert => sub { return $_; },
- time => sub { return $_; },
- wrap_comment => sub { return $_; },
- none => sub { return $_; } ,
- },
- }) || die ("Could not create Template Provider: "
- . Template::Provider->error() . "\n");
+ $::template = Bugzilla::Template->create();
+ foreach $::templatepath (@templatepaths) {
# Traverse the template hierarchy.
find({ wanted => \&compile, no_chdir => 1 }, $::templatepath);
}