summaryrefslogtreecommitdiff
path: root/IkiWiki/Setup/Standard.pm
blob: b26df006b9d3e1d0ae58249ed4417f0f3c9f3746 (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. if (! $config{refresh}) {
  18. debug("generating wrappers..");
  19. my %startconfig=(%config);
  20. foreach my $wrapper (@{$setup{wrappers}}) {
  21. %config=(%startconfig, verbose => 0, %setup, %{$wrapper});
  22. checkconfig();
  23. gen_wrapper();
  24. }
  25. %config=(%startconfig);
  26. }
  27. foreach my $c (keys %setup) {
  28. $config{$c}=possibly_foolish_untaint($setup{$c})
  29. if defined $setup{$c} && ! ref $setup{$c};
  30. }
  31. if (! $config{refresh}) {
  32. $config{rebuild}=1;
  33. debug("rebuilding wiki..");
  34. }
  35. else {
  36. debug("refreshing wiki..");
  37. }
  38. checkconfig();
  39. lockwiki();
  40. loadindex();
  41. refresh();
  42. debug("done");
  43. saveindex();
  44. }
  45. 1