Commit 4f9f364e authored by mkanat%bugzilla.org's avatar mkanat%bugzilla.org

Bug 208714: Make checksetup.pl move $datadir/template when it can't delete it

Patch by Max Kanat-Alexander <mkanat@bugzilla.org> (module owner) a=mkanat
parent b473ef93
...@@ -792,17 +792,20 @@ sub precompile_templates { ...@@ -792,17 +792,20 @@ sub precompile_templates {
if (-e "$datadir/template") { if (-e "$datadir/template") {
print install_string('template_removing_dir') . "\n" if $output; print install_string('template_removing_dir') . "\n" if $output;
# XXX This frequently fails if the webserver made the files, because # This frequently fails if the webserver made the files, because
# then the webserver owns the directories. We could fix that by # then the webserver owns the directories.
# doing a chmod/chown on all the directories here.
rmtree("$datadir/template"); rmtree("$datadir/template");
# Check that the directory was really removed # Check that the directory was really removed, and if not, move it
if(-e "$datadir/template") { # into data/deleteme/.
print "\n\n"; if (-e "$datadir/template") {
print "The directory '$datadir/template' could not be removed.\n"; print STDERR "\n\n",
print "Please remove it manually and rerun checksetup.pl.\n\n"; install_string('template_removal_failed',
exit; { datadir => $datadir }), "\n\n";
mkpath("$datadir/deleteme");
my $random = generate_random_password();
rename("$datadir/template", "$datadir/deleteme/$random")
or die "move failed: $!";
} }
} }
......
...@@ -145,6 +145,11 @@ EOT ...@@ -145,6 +145,11 @@ EOT
* top of the displayed list. * * top of the displayed list. *
EOT EOT
template_precompile => "Precompiling templates...", template_precompile => "Precompiling templates...",
template_removal_failed => <<END,
WARNING: The directory '##datadir##/template' could not be removed.
It has been moved into '##datadir##/deleteme', which should be
deleted manually to conserve disk space.
END
template_removing_dir => "Removing existing compiled templates...", template_removing_dir => "Removing existing compiled templates...",
); );
......
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