fix oops in %config handling
[ikiwiki.git] / IkiWiki / Setup / Standard.pm
1 #!/usr/bin/perl
2 # Standard ikiwiki setup module.
3 # Parameters to import should be all the standard ikiwiki config stuff,
4 # plus hashes for cgiwrapper and svnwrapper, which specify any differing
5 # config stuff for them and cause the wrappers to be made.
6
7 package IkiWiki::Setup::Standard;
8
9 use warnings;
10 use strict;
11
12 sub import {
13         my %setup=%{$_[1]};
14
15         ::debug("generating wrappers..");
16         my %startconfig=(%::config);
17         foreach my $wrapper (@{$setup{wrappers}}) {
18                 %::config=(%startconfig, verbose => 0, %setup, %{$wrapper});
19                 ::checkoptions();
20                 ::gen_wrapper();
21         }
22
23         ::debug("rebuilding wiki..");
24         foreach my $c (keys %setup) {
25                 $::config{$c}=::possibly_foolish_untaint($setup{$c})
26                         if defined $setup{$c} && ! ref $setup{$c};
27         }
28         $::config{rebuild}=1;
29         ::checkoptions();
30         ::refresh();
31
32         ::debug("done");
33         ::saveindex();
34 }
35
36 1