From 4f9f364e9fbbdc6cf3eccd2c59372b9ff49e2a27 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Thu, 20 Aug 2009 05:55:05 +0000 Subject: Bug 208714: Make checksetup.pl move $datadir/template when it can't delete it Patch by Max Kanat-Alexander (module owner) a=mkanat --- Bugzilla/Template.pm | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index d897cd946..05ce2dde5 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -792,17 +792,20 @@ sub precompile_templates { if (-e "$datadir/template") { print install_string('template_removing_dir') . "\n" if $output; - # XXX This frequently fails if the webserver made the files, because - # then the webserver owns the directories. We could fix that by - # doing a chmod/chown on all the directories here. + # This frequently fails if the webserver made the files, because + # then the webserver owns the directories. rmtree("$datadir/template"); - # Check that the directory was really removed - if(-e "$datadir/template") { - print "\n\n"; - print "The directory '$datadir/template' could not be removed.\n"; - print "Please remove it manually and rerun checksetup.pl.\n\n"; - exit; + # Check that the directory was really removed, and if not, move it + # into data/deleteme/. + if (-e "$datadir/template") { + print STDERR "\n\n", + install_string('template_removal_failed', + { datadir => $datadir }), "\n\n"; + mkpath("$datadir/deleteme"); + my $random = generate_random_password(); + rename("$datadir/template", "$datadir/deleteme/$random") + or die "move failed: $!"; } } -- cgit v1.2.3-24-g4f1b