diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2011-11-26 14:18:04 +0100 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2011-11-26 14:18:04 +0100 |
commit | fb5a11226b8c5c65df7afa90547e6ddfe711a839 (patch) | |
tree | 04fe86e61cbf4861fba5b8c071c76b8b985dba1a /Bugzilla/Install | |
parent | 39a3753d0cd38ff1752b00f24627cbaba412848a (diff) | |
download | bugzilla-fb5a11226b8c5c65df7afa90547e6ddfe711a839.tar.gz bugzilla-fb5a11226b8c5c65df7afa90547e6ddfe711a839.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.pm | 27 |
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 |