summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Template.pm
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-11-24 07:30:46 +0100
committermkanat%bugzilla.org <>2009-11-24 07:30:46 +0100
commitc712ae5d7dcd4c4874def8b8e9c84d301dcda20e (patch)
treebad560de491ebd39456364b11094c85efe1ecab2 /Bugzilla/Template.pm
parent5fc80f94271780b6ff6d1dbba554df35e803ac51 (diff)
downloadbugzilla-c712ae5d7dcd4c4874def8b8e9c84d301dcda20e.tar.gz
bugzilla-c712ae5d7dcd4c4874def8b8e9c84d301dcda20e.tar.xz
Post-checkin fix for bug 430012: Make checksetup not throw a warning when there are no extension templates that got compiled.
Diffstat (limited to 'Bugzilla/Template.pm')
-rw-r--r--Bugzilla/Template.pm33
1 files changed, 18 insertions, 15 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index ce7c2ab1c..c3c7a9fac 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -884,21 +884,24 @@ sub _do_template_symlink {
# need to do this symlink.
return if ($abs_path eq $dir_to_symlink);
- my $abs_root = dirname($abs_path);
- my $dir_name = basename($abs_path);
- my $datadir = bz_locations()->{'datadir'};
- my $todir = "$datadir/template$abs_root";
- mkpath($todir);
- # We use abs2rel so that the symlink will look like
- # "../../../../template" which works, while just
- # "data/template/template/" doesn't work.
- my $fromdir = File::Spec->abs2rel("$datadir/template/$dir_name", $todir);
-
- my $target = "$todir/$dir_name";
- # We eval for systems that can't symlink at all, where "symlink"
- # throws a fatal error.
- eval { symlink($fromdir, $target) }
- or warn "Failed to symlink from $fromdir to $target: $!";
+ my $abs_root = dirname($abs_path);
+ my $dir_name = basename($abs_path);
+ my $datadir = bz_locations()->{'datadir'};
+ my $container = "$datadir/template$abs_root";
+ mkpath($container);
+ my $target = "$datadir/template/$dir_name";
+ # Check if the directory exists, because if there are no extensions,
+ # there won't be an "data/template/extensions" directory to link to.
+ if (-d $target) {
+ # We use abs2rel so that the symlink will look like
+ # "../../../../template" which works, while just
+ # "data/template/template/" doesn't work.
+ my $relative_target = File::Spec->abs2rel($target, $container);
+
+ my $link_name = "$container/$dir_name";
+ symlink($relative_target, $link_name)
+ or warn "Could not make $link_name a symlink to $relative_target: $!";
+ }
}
1;