Skip to content

Commit

Permalink
Item8640: Add routine to apply file permissions from manifest
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@6667 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Mar 7, 2010
1 parent 1142bca commit 31543c6
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion core/lib/Foswiki/Configure/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,36 @@ sub installFiles {

=begin TML
---++ StaticMethod applyManifest($root, @names, \%MANIFEST )
Check each installed file against the manifest. Apply the
mode to the file.
=cut

sub applyManifest {
my $root = shift;
my $files = shift;

# foreach file in list, move it to the correct place
foreach my $file (@$files) {

# Find where it is meant to go
my $target = Foswiki::Configure::Util::mapTarget($root,$file);

if (-f $target) {

my $mode = $_[0]->{$file}->{perms};

if ($mode) {
$target = Foswiki::Sandbox::untaintUnchecked($target);
$mode = Foswiki::Sandbox::untaintUnchecked($mode);
chmod( oct($mode), $target);
}
}
}
}
=begin TML
---++ StaticMethod getPerlLocation( )
This routine will read in the first line of the bin/configure
script and recover the location of the perl interpreter.
Expand Down Expand Up @@ -469,7 +499,7 @@ sub _parseManifest {
my $perms = '';
my $md5 = '';
my $desc = '';

if ( $_[2] ) {
( $file, $perms, $md5, $desc ) = split( ',', $_[1], 4 ) ;
} else {
Expand Down Expand Up @@ -499,6 +529,8 @@ the file.

sub _parseDependency {

require Foswiki::Sandbox;

my $warn = undef;
my ( $module, $condition, $trigger, $type, $desc ) =
split( ',', $_[1], 5 );
Expand Down

0 comments on commit 31543c6

Please sign in to comment.