summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Install
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2011-11-26 14:12:47 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2011-11-26 14:12:47 +0100
commit7a9a9a8f1e4c1d17ff58fb0bbae9513c85986488 (patch)
tree7ffcce8ab7c299883ef3db554d3759835bf24057 /Bugzilla/Install
parentc9aaffd4541554af069e4ac097c39f567b02f55a (diff)
downloadbugzilla-7a9a9a8f1e4c1d17ff58fb0bbae9513c85986488.tar.gz
bugzilla-7a9a9a8f1e4c1d17ff58fb0bbae9513c85986488.tar.xz
Bug 368250: collectstats.pl creates files with wrong ownership
r/a=mkanat
Diffstat (limited to 'Bugzilla/Install')
-rw-r--r--Bugzilla/Install/Filesystem.pm27
1 files changed, 27 insertions, 0 deletions
diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm
index 15106dab9..c5215ecfa 100644
--- a/Bugzilla/Install/Filesystem.pm
+++ b/Bugzilla/Install/Filesystem.pm
@@ -46,6 +46,7 @@ our @EXPORT = qw(
update_filesystem
create_htaccess
fix_all_file_permissions
+ fix_dir_permissions
fix_file_permissions
);
@@ -645,6 +646,26 @@ sub _update_old_charts {
}
}
+sub fix_dir_permissions {
+ my ($dir) = @_;
+ return if ON_WINDOWS;
+ # Note that _get_owner_and_group is always silent here.
+ my ($owner_id, $group_id) = _get_owner_and_group();
+
+ my $perms;
+ my $fs = FILESYSTEM();
+ if ($perms = $fs->{recurse_dirs}->{$dir}) {
+ _fix_perms_recursively($dir, $owner_id, $group_id, $perms);
+ }
+ elsif ($perms = $fs->{all_dirs}->{$dir}) {
+ _fix_perms($dir, $owner_id, $group_id, $perms);
+ }
+ else {
+ # Do nothing. We know nothing about this directory.
+ warn "Unknown directory $dir";
+ }
+}
+
sub fix_file_permissions {
my ($file) = @_;
return if ON_WINDOWS;
@@ -843,6 +864,12 @@ Params: C<$output> - C<true> if you want this function to print
Returns: nothing
+=item C<fix_dir_permissions>
+
+Given the name of a directory, its permissions will be fixed according to
+how they are supposed to be set in Bugzilla's current configuration.
+If it fails to set the permissions, a warning will be printed to STDERR.
+
=item C<fix_file_permissions>
Given the name of a file, its permissions will be fixed according to