summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-07-13 09:37:59 +0200
committerYorhel <git@yorhel.nl>2019-07-13 09:40:01 +0200
commite7324932590b0f8887500e98b5672d06b080954d (patch)
tree0f5a35f6ce2a965e2516127a7c9d8e87a6ae6580
parented2eff28b10338f09407ac1d022b7bd74f7fbf46 (diff)
Update util/unusedimages.plv3
(cherry picked from commit e7cf38f4c5b32f73de89bf61bda43ac3876ad897)
-rwxr-xr-xutil/unusedimages.pl26
1 files changed, 12 insertions, 14 deletions
diff --git a/util/unusedimages.pl b/util/unusedimages.pl
index 3a40d575..b5eb3989 100755
--- a/util/unusedimages.pl
+++ b/util/unusedimages.pl
@@ -62,37 +62,35 @@ sub addnumsql {
print "# Items in $name... $count\n";
}
-sub adddoc {
- $count = 0;
- for my $fn (glob("$ROOT/data/docs/*")) {
- local $/=undef;
- open my $F, $fn or die "Can't open $fn: $!\n";
- addtxt scalar <$F>;
- }
- print "# Referencs in the docs: $count\n";
-}
-
sub findunused {
my $size = 0;
$count = 0;
+ my $left = 0;
find {
no_chdir => 1,
+ follow => 1,
wanted => sub {
- return if $File::Find::name !~ /($fnmatch)$/;
+ return if -d "$File::Find::name";
+ if($File::Find::name !~ /($fnmatch)$/) {
+ print "# Unknown file: $File::Find::name\n";
+ return;
+ }
if(!$dir{$2}{$3}) {
my $s = (-s $File::Find::name) / 1024;
$size += $s;
$count++;
printf "rm '%s' # %d KiB, https://s.vndb.org%s\n", $File::Find::name, $s, $1
+ } else {
+ $left++;
}
}
- }, "$ROOT/static";
- printf "# Deleted %d files, saved %d KiB\n", $count, $size;
+ }, "$ROOT/static/cv", "$ROOT/static/ch", "$ROOT/static/sf", "$ROOT/static/st";
+ printf "# Deleted %d files, left %d files, saved %d KiB\n", $count, $left, $size;
}
cleandb;
-adddoc;
+addtxtsql 'Docs', 'SELECT content FROM docs UNION ALL SELECT content FROM docs_hist';
addtxtsql 'VN descriptions', 'SELECT "desc" FROM vn UNION ALL SELECT "desc" FROM vn_hist';
addtxtsql 'Character descriptions', 'SELECT "desc" FROM chars UNION ALL SELECT "desc" FROM chars_hist';
addtxtsql 'Producer descriptions', 'SELECT "desc" FROM producers UNION ALL SELECT "desc" FROM producers_hist';