summaryrefslogtreecommitdiffstats
path: root/checksetup.pl
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 /checksetup.pl
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.
Diffstat (limited to 'checksetup.pl')
-rwxr-xr-xchecksetup.pl47
1 files changed, 7 insertions, 40 deletions
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);
}