add --refresh and make it with with --setup

master
joey 2006-03-26 05:08:41 +00:00
parent da1f96550e
commit ffc0be87d7
6 changed files with 34 additions and 17 deletions

View File

@ -513,7 +513,7 @@ sub cgi () { #{{{
# is entered
my $page=lc($q->param('title'));
$page=~y/ /_/;
$page=~s/([^-A-Za-z0-9_:+/])/"__".ord($1)."__"/eg;
$page=~s/([^-A-Za-z0-9_:+\/])/"__".ord($1)."__"/eg;
# if the page already exist, munge it to be unique
my $from=$q->param('from');
my $add="";

View File

@ -19,6 +19,7 @@ sub setup () { # {{{
eval $code;
error($@) if $@;
exit;
} #}}}

View File

@ -20,21 +20,27 @@ package IkiWiki;
sub setup_standard {
my %setup=%{$_[1]};
debug("generating wrappers..");
my %startconfig=(%config);
foreach my $wrapper (@{$setup{wrappers}}) {
%config=(%startconfig, verbose => 0, %setup, %{$wrapper});
checkconfig();
gen_wrapper();
if (! $config{refresh}) {
debug("generating wrappers..");
my %startconfig=(%config);
foreach my $wrapper (@{$setup{wrappers}}) {
%config=(%startconfig, verbose => 0, %setup, %{$wrapper});
checkconfig();
gen_wrapper();
}
%config=(%startconfig);
}
%config=(%startconfig);
debug("rebuilding wiki..");
foreach my $c (keys %setup) {
$config{$c}=possibly_foolish_untaint($setup{$c})
if defined $setup{$c} && ! ref $setup{$c};
}
$config{rebuild}=1;
if (! $config{refresh}) {
$config{rebuild}=1;
debug("rebuilding wiki..");
}
else {
debug("refreshing wiki..");
}
checkconfig();
lockwiki();

View File

@ -25,3 +25,6 @@
will linger around and not be deleted.
* Currently only one blog is supported per page. Attempts to add more
will make it only update one of the blogs on the page.
* If I edit blog/entry/blog_moved, add a link to code/ikiwiki, and hit
preview, it doesn't get the link right because it makes it relative to
where the page will be saved to, not to where the cgi script is.

View File

@ -30,6 +30,11 @@ flags such as --verbose can be negated with --no-verbose.
Force a rebuild of all pages.
* --refresh
Refresh the wiki, updating any changes pages. This is the default
behavior so you don't normally need to specify it.
* --fixctime
Pull last changed time for all pages out of the revision control system.
@ -117,12 +122,12 @@ flags such as --verbose can be negated with --no-verbose.
* --setup configfile
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; 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.
program that can call ikiwiki internal functions.
The default action when --setup is specified is to automatically generate
wrappers for a wiki based on data in a config file, and rebuild the wiki.
If you also pass the --refresh option, ikiwiki will instead just refresh
the wiki described in the setup file.
[[ikiwiki.setup]] is an example of such a config file.

View File

@ -34,6 +34,7 @@ sub getconfig () { #{{{
anonok => 0,
rss => 0,
rebuild => 0,
refresh => 0,
getctime => 0,
wrapper => undef,
wrappermode => undef,
@ -50,6 +51,7 @@ sub getconfig () { #{{{
"wikiname=s" => \$config{wikiname},
"verbose|v!" => \$config{verbose},
"rebuild!" => \$config{rebuild},
"refresh!" => \$config{refresh},
"getctime" => \$config{getctime},
"wrappermode=i" => \$config{wrappermode},
"svn!" => \$config{svn},