chrootsetup_linux.sh: include libnss_files.so* in chroot
[girocco.git] / toolbox / clear-all-htmlcache.pl
blob60114f1bae8e2756f6e5f79640f4ca38dae9f02e
1 #!/usr/bin/perl
3 # Remove all files present in the htmlcache subdirectory of each project.
4 # A count of projects that had files to be removed is displayed.
6 use strict;
7 use warnings;
9 use lib "__BASEDIR__";
10 use Girocco::Config;
11 use Girocco::CLIUtil;
12 use Girocco::Project;
14 nice_me(18);
15 my $bd = $Girocco::Config::reporoot . '/';
16 my @projects = Girocco::Project::get_full_list();
17 my $progress = Girocco::CLIUtil::Progress->new(
18 scalar(@projects), "Clearing htmlcache files");
19 my $cleared = 0;
20 foreach (@projects) {
21 my $hcd = $bd . $_ . ".git/htmlcache";
22 opendir my $dh, $hcd or next;
23 my @files = map({/^(?![.][.]?$)(.*)$/ ? $1 : ()} readdir($dh));
24 closedir $dh;
25 unlink($hcd . "/" . $_) foreach @files;
26 @files and ++$cleared;
27 } continue {$progress->update}
28 $progress = undef;
29 print "Projects cleared: $cleared\n";
30 exit 0