add rebuild after calling setup, better format for setup files

master
joey 2006-03-13 19:10:29 +00:00
parent ac69a97905
commit f7f45d6a0a
4 changed files with 32 additions and 13 deletions

View File

@ -89,8 +89,13 @@ flags such as --verbose can be negated with --no-verbose.
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

View File

@ -11,4 +11,5 @@ play when linking between [[SubPage]]s.
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.

11
ikiwiki
View File

@ -1152,6 +1152,7 @@ sub cgi () { #{{{
sub setup () { # {{{
my $setup=possibly_foolish_untaint($config{setup});
delete $config{setup};
open (IN, $setup) || error("read $setup: $!\n");
local $/=undef;
my $code=<IN>;
@ -1159,7 +1160,15 @@ sub setup () { # {{{
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;
} #}}}

View File

@ -5,7 +5,8 @@
#
# Remember to re-run ikiwiki --setup any time you edit this file.
my %common=(
%config=(%config,
wikiname => "MyWiki",
# Be sure to customise these..
@ -14,7 +15,7 @@ my %common=(
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,
@ -22,18 +23,21 @@ my %common=(
# 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};