diff options
author | Yorhel <git@yorhel.nl> | 2008-12-29 13:42:58 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2008-12-29 13:42:58 +0100 |
commit | 3c1b01ec2ba0328f74aa7269bae8015cf1faf531 (patch) | |
tree | 32be3bc4696399abf14e09f1f8f78f38f92509dc /util/vndb.pl | |
parent | 1ef9db32e893669cc5da7b69b371ef051008b989 (diff) | |
parent | f000aaf69e345bae4fc5581e5028463c85cfdafb (diff) |
Merge branch 'beta'2.1
Diffstat (limited to 'util/vndb.pl')
-rwxr-xr-x | util/vndb.pl | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/util/vndb.pl b/util/vndb.pl index 5ef0bf40..a9ac36b4 100755 --- a/util/vndb.pl +++ b/util/vndb.pl @@ -22,6 +22,11 @@ use YAWF ':html'; our(%O, %S); +# load and (if required) regenerate the skins +# NOTE: $S{skins} can be modified in data/config.pl, allowing deletion of skins or forcing only one skin +$S{skins} = readskins(); + + # load settings from global.pl require $ROOT.'/data/global.pl'; @@ -73,3 +78,28 @@ sub handle404 { } +sub readskins { + my %skins; # dirname => skin name + my $regen = 0; + my $lasttemplate = [stat "$ROOT/data/skingen/style.css"]->[9]; + for my $f (glob "$ROOT/static/s/*") { + my $n = $1 if $f =~ m{([^/]+)$}; + open my $F, '<', "$f/conf" or die $!; + while(<$F>) { + chomp; + s{[\t\s]*//.*$}{}; + next if !/^name[\t\s]+(.+)$/; + $skins{$n} = $1; + last; + } + close $F; + + 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"; + } + # note: this only works if the current process has write access to the skins + `$ROOT/util/skingen.pl` if $regen; + return \%skins; +} + |