4d1118f304b871024b93157a4c5fea941ed96cd9
[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         %::config=(%startconfig);
23         
24         ::debug("rebuilding wiki..");
25         foreach my $c (keys %setup) {
26                 $::config{$c}=::possibly_foolish_untaint($setup{$c})
27                         if defined $setup{$c} && ! ref $setup{$c};
28         }
29         $::config{rebuild}=1;
30         ::checkoptions();
31         ::refresh();
32
33         ::debug("done");
34         ::saveindex();
35 }
36
37 1