summaryrefslogtreecommitdiff
path: root/IkiWiki/Setup/Standard.pm
blob: c5a67afdf7cce69f4e1fea08f7dae4b377f14111 (plain)
  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. use warnings;
  7. use strict;
  8. use IkiWiki::Wrapper;
  9. use IkiWiki::Render;
  10. package IkiWiki::Setup::Standard;
  11. sub import {
  12. IkiWiki::setup_standard(@_);
  13. }
  14. package IkiWiki;
  15. sub setup_standard {
  16. my %setup=%{$_[1]};
  17. debug("generating wrappers..");
  18. my %startconfig=(%config);
  19. foreach my $wrapper (@{$setup{wrappers}}) {
  20. %config=(%startconfig, verbose => 0, %setup, %{$wrapper});
  21. checkconfig();
  22. gen_wrapper();
  23. }
  24. %config=(%startconfig);
  25. debug("rebuilding wiki..");
  26. foreach my $c (keys %setup) {
  27. $config{$c}=possibly_foolish_untaint($setup{$c})
  28. if defined $setup{$c} && ! ref $setup{$c};
  29. }
  30. $config{rebuild}=1;
  31. checkconfig();
  32. lockwiki();
  33. loadindex();
  34. refresh();
  35. debug("done");
  36. saveindex();
  37. }
  38. 1