summaryrefslogtreecommitdiff
path: root/util/vndb.pl
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2008-12-31 15:58:00 +0100
committerYorhel <git@yorhel.nl>2009-01-02 17:02:07 +0100
commitce96d68ba80558dd7168d4d3caf6160e4e88f9d0 (patch)
tree6750558a5c61d7e240c638f11e8b28df13c05d67 /util/vndb.pl
parent0f421f5d809648b9bfc3134216dafaf2a46bf876 (diff)
Improved the skin reader and updater in vndb.pl
Less error prone, and only updates the skins that need updating and are actually writable.
Diffstat (limited to 'util/vndb.pl')
-rwxr-xr-xutil/vndb.pl15
1 files changed, 9 insertions, 6 deletions
diff --git a/util/vndb.pl b/util/vndb.pl
index a9ac36b4..335ad488 100755
--- a/util/vndb.pl
+++ b/util/vndb.pl
@@ -80,9 +80,10 @@ sub handle404 {
sub readskins {
my %skins; # dirname => skin name
- my $regen = 0;
+ my @regen;
my $lasttemplate = [stat "$ROOT/data/skingen/style.css"]->[9];
for my $f (glob "$ROOT/static/s/*") {
+ next if !-e "$f/conf";
my $n = $1 if $f =~ m{([^/]+)$};
open my $F, '<', "$f/conf" or die $!;
while(<$F>) {
@@ -93,13 +94,15 @@ sub readskins {
last;
}
close $F;
+ next if !$skins{$n};
- my $lastgen = [stat "$f/style.css"]->[9];
- $regen = 1 if (!-f "$f/style.css" && -x $f)
- || ([stat "$f/conf"]->[9] > $lastgen || $lasttemplate > $lastgen) && -w "$f/style.css";
+ my $css = -f "$f/style.css" && [stat "$f/style.css"]->[9];
+ my $boxbg = -f "$f/boxbg.png" && [stat "$f/boxbg.png"]->[9];
+ my $lastgen = $css < $boxbg ? $css : $boxbg;
+ push @regen, $n if (!$lastgen && -x $f && ($css && -w "$f/style.css" || $boxbg && -w "$f/boxbg.png"))
+ || ([stat "$f/conf"]->[9] > $lastgen || $lasttemplate > $lastgen) && -w "$f/style.css" && -w "$f/boxbg.png";
}
- # note: this only works if the current process has write access to the skins
- `$ROOT/util/skingen.pl` if $regen;
+ system "$ROOT/util/skingen.pl", @regen if @regen;
return \%skins;
}