- # TODO save to real path
- IkiWiki::Setup::dump("/tmp/s");
- $form->text(gettext("Setup saved."));
+ my $oldsetup=readfile($config{setupfile});
+ IkiWiki::Setup::dump($config{setupfile});
+
+ IkiWiki::saveindex();
+ IkiWiki::unlockwiki();
+
+ # Print the top part of a standard cgitemplate,
+ # then show the rebuild or refresh, live.
+ my $divider="\0";
+ my $html=IkiWiki::cgitemplate($cgi, "setup", $divider);
+ IkiWiki::printheader($session);
+ my ($head, $tail)=split($divider, $html, 2);
+ print $head."<pre>\n";
+
+ my @command;
+ if ($form->submitted eq 'Rebuild Wiki') {
+ @command=("ikiwiki", "-setup", $config{setupfile},
+ "-rebuild", "-v");
+ }
+ else {
+ @command=("ikiwiki", "-setup", $config{setupfile},
+ "-refresh", "-wrappers", "-v");
+ }