summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Install/Filesystem.pm
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2011-11-28 17:51:37 +0100
committerDave Lawrence <dlawrence@mozilla.com>2011-11-28 17:51:37 +0100
commit969f20eadc0d3ca5440d69e4afbae70d66f41b57 (patch)
treeb71ce564c9f8c60ba2c8870fa1e596c4a0e680c3 /Bugzilla/Install/Filesystem.pm
parent0d3a92e3c8ed0b80e08a13536358d5346b8015fd (diff)
parent2fe1db36b3ced43ca9b76a5fbc293c845fd13066 (diff)
downloadbugzilla-969f20eadc0d3ca5440d69e4afbae70d66f41b57.tar.gz
bugzilla-969f20eadc0d3ca5440d69e4afbae70d66f41b57.tar.xz
merged with bugzilla/4.2
Diffstat (limited to 'Bugzilla/Install/Filesystem.pm')
-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 e6783bbee..c3f103aaa 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
);
@@ -651,6 +652,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;
@@ -849,6 +870,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