Commit 7d90e43e authored by mkanat%bugzilla.org's avatar mkanat%bugzilla.org

Bug 383522: mod_perl creates a separate template directory

Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=mkanat
parent 9f774e4a
...@@ -790,17 +790,20 @@ sub precompile_templates { ...@@ -790,17 +790,20 @@ sub precompile_templates {
# *compiled* versions using the full absolute path under the data/template # *compiled* versions using the full absolute path under the data/template
# directory. (Like data/template/var/www/html/mod_perl/.) To avoid # directory. (Like data/template/var/www/html/mod_perl/.) To avoid
# re-compiling templates under mod_perl, we symlink to the # re-compiling templates under mod_perl, we symlink to the
# already-compiled templates. # already-compiled templates. This doesn't work on Windows.
my $abs_root = dirname(abs_path($templatedir)); if (!ON_WINDOWS) {
mkpath("$datadir/template$abs_root"); my $abs_root = dirname(abs_path($templatedir));
my $todir = "$datadir/template$abs_root"; my $todir = "$datadir/template$abs_root";
# We use abs2rel so that the symlink will look like "../../../../template" mkpath($todir);
# which works, while just "data/template/template/" doesn't work. # We use abs2rel so that the symlink will look like
my $fromdir = File::Spec->abs2rel("$datadir/template/template", $todir); # "../../../../template" which works, while just
# We eval for systems (like Windows) that can't symlink, where "symlink" # "data/template/template/" doesn't work.
# throws a fatal error. my $fromdir = File::Spec->abs2rel("$datadir/template/template", $todir);
eval { symlink($fromdir, "$todir/template") # We eval for systems that can't symlink at all, where "symlink"
or warn "Failed to symlink from $fromdir to $todir: $!" }; # throws a fatal error.
eval { symlink($fromdir, "$todir/template")
or warn "Failed to symlink from $fromdir to $todir: $!" };
}
# If anything created a Template object before now, clear it out. # If anything created a Template object before now, clear it out.
delete Bugzilla->request_cache->{template}; delete Bugzilla->request_cache->{template};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment