In setup mode, ikiwiki reads the config file, which is really a perl
program that can call ikiwiki internal functions. Uses of this are
- various; one is to automatically generate wrappers for a wiki based on
- data in a config file.
+ various; the normal one is to automatically generate wrappers for a
+ wiki based on data in a config file.
+
+ Note that the wiki will be (re)built as part of the setup process to
+ ensure that any changes take effect.
+
+ [[ikiwiki.setup]] is an example of such a config file.
# AUTHOR
WikiLinks can be entered in any case you like, the page they link to is
always lowercased.
-Note that if the file linked to by a WikiLink looks like an image, it will be displayed inline on the page.
+Note that if the file linked to by a WikiLink looks like an image, it will
+be displayed inline on the page.
sub setup () { # {{{
my $setup=possibly_foolish_untaint($config{setup});
+ delete $config{setup};
open (IN, $setup) || error("read $setup: $!\n");
local $/=undef;
my $code=<IN>;
close IN;
eval $code;
error($@) if $@;
- print "ikiwiki setup complete\n";
+ print "$config{wikiname} setup complete, now forcing a rebuild.\n";
+ $config{cgi}=0;
+ $config{rebuild}=1;
+ foreach my $c (keys %config) {
+ $config{$c}=possibly_foolish_untaint($config{$c})
+ if defined $config{$c};
+ }
+ refresh();
+ saveindex();
exit;
} #}}}
#
# Remember to re-run ikiwiki --setup any time you edit this file.
-my %common=(
+%config=(%config,
+
wikiname => "MyWiki",
# Be sure to customise these..
destdir => "/var/www/wiki",
url => "http://myhost/wiki",
cgiurl => "http://myhost/ikiwiki.cgi",
- historyurl => "$webdir/cgi-bin/viewcvs?[[]]"
+ #historyurl => "http://svn.myhost/trunk/[[]]",
# Whether to integrate with svn.
svn => 1,
# Can anonymous web users edit pages?
#anonok => 1,
+
);
-gen_wrapper(
- %common,
+gen_wrapper(%config,
+
cgi => 1,
- wrapper => "$common{destdir}/ikiwiki.cgi",
+ wrapper => "$config{destdir}/ikiwiki.cgi",
wrappermode => 06755,
+
);
-gen_wrapper(
- %common,
+gen_wrapper(%config,
+
# Note that this will overwrite any exsting post-commit hoo
# script, which may not be what you want.
- wrapper => "$common{svnrepo}/hooks/post-commit",
+ wrapper => "$config{svnrepo}/hooks/post-commit",
wrappermode => 04755,
-) if $common{$svn};
+
+) if $config{$svn};