Skip to content

Commit 5428803

Browse files
authored
Merge pull request sympa-community#702 from ikedas/issue-700 by ikedas
stats page generates spurious warnings in stderr (sympa-community#700)
2 parents f4fe08a + 64d31ee commit 5428803

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/lib/Sympa/Tools/File.pm

+6-12
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,12 @@ sub get_dir_size {
201201
my $dir = shift;
202202

203203
my $size = 0;
204-
205-
if (opendir(DIR, $dir)) {
206-
foreach my $file (sort grep (!/^\./, readdir(DIR))) {
207-
if (-d "$dir/$file") {
208-
$size += get_dir_size("$dir/$file");
209-
} else {
210-
my @info = stat "$dir/$file";
211-
$size += $info[7];
212-
}
213-
}
214-
closedir DIR;
215-
}
204+
File::Find::find(
205+
sub {
206+
$size += -s $File::Find::name if -f $File::Find::name;
207+
},
208+
$dir
209+
);
216210

217211
return $size;
218212
}

0 commit comments

Comments
 (0)