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 {
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: $!";
}
}
......
......@@ -145,6 +145,11 @@ EOT
* top of the displayed list. *
EOT
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...",
);
......
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