if ($config{cgi}) {
print "Content-type: text/html\n\n";
print misctemplate("Error", "<p>Error: @_</p>");
- exit 1;
- }
- else {
- die @_;
}
+ die @_;
} #}}}
sub debug ($) { #{{{
my $skip=1;
foreach my $dir (reverse split("/", $page)) {
if (! $skip) {
+ $path.="../";
unshift @ret, { url => "$path$dir.html", page => $dir };
}
else {
$skip=0;
}
- $path.="../";
}
- unshift @ret, { url => $path , page => $config{wikiname} };
+ unshift @ret, { url => length $path ? $path : ".", page => $config{wikiname} };
return @ret;
} #}}}
my $src=shift;
if (! exists $renderedfiles{$src} && -e $dest && ! $config{rebuild}) {
- error("$dest exists and was rendered from ".
+ error("$dest already exists and was rendered from ".
join(" ",(grep { $renderedfiles{$_} eq $dest } keys
%renderedfiles)).
- ", not from $src before not overwriting");
+ ", before, so not rendering from $src");
}
} #}}}
push @params, "--cgiurl=$config{cgiurl}" if length $config{cgiurl};
push @params, "--historyurl=$config{historyurl}" if length $config{historyurl};
push @params, "--anonok" if $config{anonok};
- my $params=join(" ", map { "\'$_\'" } @params);
+ my $params=join(" ", @params);
my $call='';
foreach my $p ($this, $this, @params) {
$call.=qq{"$p", };
rcs_commit($message);
}
else {
+ loadindex();
refresh();
+ saveindex();
}
# The trailing question mark tries to avoid broken
sub setup () { # {{{
my $setup=possibly_foolish_untaint($config{setup});
+ delete $config{setup};
open (IN, $setup) || error("read $setup: $!\n");
local $/=undef;
my $code=<IN>;
($code)=$code=~/(.*)/s;
close IN;
+
+ my (%setup);
eval $code;
error($@) if $@;
- print "ikiwiki setup complete\n";
+
+ gen_wrapper(%config, %setup, %{$setup{cgiwrapper}}) if $setup{cgiwrapper};
+ gen_wrapper(%config, %setup, %{$setup{svnwrapper}}) if $setup{svnwrapper};
+
+ print "$setup{wikiname} setup complete, now forcing a rebuild\n";
+ foreach my $c (keys %setup) {
+ $config{$c}=possibly_foolish_untaint($setup{$c})
+ if defined $setup{$c} && ! ref $setup{$c};
+ }
+ $config{rebuild}=1;
+ refresh();
+ saveindex();
exit;
} #}}}