Skip to content

Commit

Permalink
Item620: perltidy -b ... if we don't keep perltidy on all source code…
Browse files Browse the repository at this point in the history
…, it's really hard to merge and see proper diff :(

git-svn-id: http://svn.foswiki.org/trunk@2468 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
OlivierRaginel authored and OlivierRaginel committed Feb 12, 2009
1 parent 1442d15 commit 767db15
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions core/tools/extender.pl
Expand Up @@ -50,6 +50,7 @@ package Foswiki::Extender;

BEGIN {
$installationRoot = Cwd::getcwd();

# getcwd is often a simple `pwd` thus it's tainted, untaint it
$installationRoot =~ /^(.*)$/;
$installationRoot = $1;
Expand Down Expand Up @@ -557,10 +558,11 @@ sub unzip {

eval 'use Archive::Zip';
unless ($@) {
my $zip = Archive::Zip->new();
my $numberOfFiles = $zip->read( $archive );
unless ($numberOfFiles > 0) {
print STDERR "Could not openzip file $archive (".$zip->error()."\n";
my $zip = Archive::Zip->new();
my $numberOfFiles = $zip->read($archive);
unless ( $numberOfFiles > 0 ) {
print STDERR "Could not openzip file $archive ("
. $zip->error() . "\n";
return 0;
}

Expand Down Expand Up @@ -601,8 +603,9 @@ sub untar {
unless ($@) {
my $tar = Archive::Tar->new();
my $numberOfFiles = $tar->read( $archive, $compressed );
unless ($numberOfFiles > 0) {
print STDERR "Could not open tar file $archive (".$tar->error()."\n";
unless ( $numberOfFiles > 0 ) {
print STDERR "Could not open tar file $archive ("
. $tar->error() . "\n";
return 0;
}

Expand Down Expand Up @@ -664,8 +667,7 @@ sub checkin {

my ( $tmp, $tmpfilename ) = File::Temp::tempfile( unlink => 1 );
File::Copy::copy( $origfile, $tmpfilename )
|| die
"$origfile could not be copied to tmp dir ($tmpfilename): $!";
|| die "$origfile could not be copied to tmp dir ($tmpfilename): $!";
eval {
Foswiki::Func::saveAttachment(
$web, $topic, $file,
Expand All @@ -674,8 +676,8 @@ sub checkin {
file => $tmpfilename,
filesize => $fileSize,
filedate => $fileDate
}
);
}
);
};
$err = $@;
}
Expand All @@ -691,7 +693,7 @@ sub checkin {
eval {
my ( $meta, $text ) = Foswiki::Func::readTopic( $web, $topic );
Foswiki::Func::saveTopic( $web, $topic, $meta, $text,
{ comment => 'Saved by install script' } );
{ comment => 'Saved by install script' } );
};
$err = $@;
}
Expand All @@ -715,13 +717,17 @@ sub _uninstall {
return 1 if $inactive;
my $reply = ask("Are you SURE you want to uninstall $MODULE?");
if ($reply) {
defined &Foswiki::preuninstall ? &Foswiki::preuninstall : &TWiki::preuninstall;
defined &Foswiki::preuninstall
? &Foswiki::preuninstall
: &TWiki::preuninstall;
foreach $file ( keys %$MANIFEST ) {
if ( -e $file ) {
unlink($file);
}
}
defined &Foswiki::preinstall ? &Foswiki::preinstall : &TWiki::preinstall;
defined &Foswiki::preinstall
? &Foswiki::preinstall
: &TWiki::preinstall;
print "### $MODULE uninstalled ###\n";
}
return 1;
Expand All @@ -737,8 +743,8 @@ sub _emplace {
# For each file in the MANIFEST, move the file into the installation,
# set the permissions, and check if it is a data or pub file. If it is,
# then check it in.
my @ci_topic; # topics to checkin
my @ci_attachment; # topics to checkin
my @ci_topic; # topics to checkin
my @ci_attachment; # topics to checkin
my $file;
foreach $file ( keys %$MANIFEST ) {
my $source = "$source/$file";
Expand All @@ -763,7 +769,7 @@ sub _emplace {
|| print STDERR
"WARNING: cannot set permissions on $target: $!\n";
}
if ($MANIFEST->{$file}->{ci}) {
if ( $MANIFEST->{$file}->{ci} ) {
if ( $target =~ /^data\/(\w+)\/(\w+).txt$/ ) {
push( @ci_topic, $target );
}
Expand Down Expand Up @@ -912,7 +918,7 @@ sub install {

foreach my $row ( split( /\r?\n/, $data{MANIFEST} ) ) {
my ( $file, $perms, $desc ) = split( ',', $row, 3 );
$MANIFEST->{$file}->{ci} = ($desc =~ /\(noci\)/ ? 0 : 1);
$MANIFEST->{$file}->{ci} = ( $desc =~ /\(noci\)/ ? 0 : 1 );
$MANIFEST->{$file}->{perms} = $perms;
}

Expand Down Expand Up @@ -1005,7 +1011,8 @@ sub install {
elsif ( $ARGV[$n] =~ m/(install|uninstall|manifest|dependencies)/ ) {
$action = $1;
}
# SMELL: There really shouldn't be a null argument. But installer breaks if it is there.

# SMELL: There really shouldn't be a null argument. But installer breaks if it is there.
elsif ( $ARGV[$n] eq '' ) {
$n++;
next;
Expand Down

0 comments on commit 767db15

Please sign in to comment.