added getsetup hooks for all plugins up to recentchanges

master
Joey Hess 2008-07-25 18:05:55 -04:00
parent cf6c2f142f
commit 1f8b0460c3
10 changed files with 184 additions and 5 deletions

View File

@ -16,6 +16,7 @@ my %guids;
sub import { #{{{
hook(type => "getopt", id => "aggregate", call => \&getopt);
hook(type => "getsetup", id => "aggregate", call => \&getsetup);
hook(type => "checkconfig", id => "aggregate", call => \&checkconfig);
hook(type => "needsbuild", id => "aggregate", call => \&needsbuild);
hook(type => "preprocess", id => "aggregate", call => \&preprocess);
@ -37,6 +38,24 @@ sub getopt () { #{{{
);
} #}}}
sub getsetup () { #{{{
return
aggregateinternal => {
type => "boolean",
default => 0,
description => "enable aggregation to internal pages",
safe => 0, # enabling needs manual transition
rebuild => 0,
},
aggregate_webtrigger => {
type => "boolean",
default => 0,
description => "allow aggregation to be triggered via the web",
safe => 1,
rebuild => 0,
},
} #}}}
sub checkconfig () { #{{{
if ($config{aggregate} && ! ($config{post_commit} &&
IkiWiki::commit_hook_enabled())) {

View File

@ -18,6 +18,7 @@ BEGIN {
sub import { #{{{
hook(type => "getopt", id => "amazon_s3", call => \&getopt);
hook(type => "getsetup", id => "amazon_s3", call => \&getsetup);
hook(type => "checkconfig", id => "amazon_s3", call => \&checkconfig);
} # }}}
@ -39,6 +40,54 @@ sub getopt () { #{{{
});
} #}}}
sub getsetup () { #{{{
return
amazon_s3_key_id => {
type => "boolean",
default => "",
description => "public access key id",
safe => 1,
rebuild => 0,
},
amazon_s3_key_id => {
type => "string",
default => "",
description => "file holding secret key",
safe => 0, # ikiwiki reads this file
rebuild => 0,
},
amazon_s3_bucket => {
type => "string",
default => "",
example => "mywiki",
description => "globally unique name of bucket to store wiki in",
safe => 1,
rebuild => 1,
},
amazon_s3_prefix => {
type => "string",
default => "wiki/",
description => "a prefix to prepend to each page name",
safe => 1,
rebuild => 1,
},
amazon_s3_location => {
type => "string",
default => "",
example => "EU",
description => "which S3 datacenter to use (leave blank for default)",
safe => 1,
rebuild => 1,
},
amazon_s3_dupindex => {
type => "boolean",
default => 0,
description => "store each index file twice, to allow urls ending in \"/index.html\" and \"/\"",
safe => 1,
rebuild => 1,
},
} #}}}
sub checkconfig { #{{{
foreach my $field (qw{amazon_s3_key_id amazon_s3_key_file
amazon_s3_bucket}) {

View File

@ -6,9 +6,22 @@ use strict;
use IkiWiki 2.00;
sub import { #{{{
hook(type => "canedit", id => "anonok", call => \&canedit,);
hook(type => "getsetup", id => "anonok", call => \&getsetup);
hook(type => "canedit", id => "anonok", call => \&canedit);
} # }}}
sub getsetup () { #{{{
return
anonok_pagespec => {
type => "string",
default => "",
example => "*/discussion",
description => "PageSpec to limit which pages anonymouse users can edit",
safe => 1,
rebuild => 0,
},
} #}}}
sub canedit ($$$) { #{{{
my $page=shift;
my $cgi=shift;

View File

@ -6,11 +6,24 @@ use strict;
use IkiWiki 2.00;
sub import { #{{{
hook(type => "getsetup", id => "attachment", call => \&getsetup);
hook(type => "checkconfig", id => "attachment", call => \&checkconfig);
hook(type => "formbuilder_setup", id => "attachment", call => \&formbuilder_setup);
hook(type => "formbuilder", id => "attachment", call => \&formbuilder);
} # }}}
sub getsetup () { #{{{
return
=> {
type => "string",
default => "",
example => "clamdscan -",
description => "virus checker program (reads STDIN, returns nonzero if virus found)",
safe => 0, # executed
rebuild => 0,
},
} #}}}
sub check_canattach ($$;$) { #{{{
my $session=shift;
my $dest=shift; # where it's going to be put, under the srcdir

View File

@ -30,10 +30,22 @@ my $time=time;
my @now=localtime($time);
sub import { #{{{
hook(type => "getsetup", id => "version", call => \&getsetup);
hook(type => "needsbuild", id => "version", call => \&needsbuild);
hook(type => "preprocess", id => "calendar", call => \&preprocess);
} #}}}
sub getsetup () { #{{{
return
archivebase => {
type => "string",
default => "archives",
description => "base of the archives hierarchy",
safe => 1,
rebuild => 1,
},
} #}}}
sub is_leap_year (@) { #{{{
my %params=@_;
return ($params{year} % 4 == 0 && (($params{year} % 100 != 0) || $params{year} % 400 == 0));

View File

@ -6,9 +6,21 @@ use strict;
use IkiWiki 2.00;
sub import { #{{{
hook(type => "getsetup", id => "mirrorlist", call => \&getsetup);
hook(type => "pagetemplate", id => "mirrorlist", call => \&pagetemplate);
} # }}}
sub getsetup () { #{{{
return
mirrorlist => {
type => "string",
default => "",
description => "list of mirrors",
safe => 1,
rebuild => 1,
},
} #}}}
sub pagetemplate (@) { #{{{
my %params=@_;
my $template=$params{template};

View File

@ -8,6 +8,7 @@ use IkiWiki 2.00;
sub import { #{{{
hook(type => "getopt", id => "openid", call => \&getopt);
hook(type => "getsetup", id => "openid", call => \&getsetup);
hook(type => "auth", id => "openid", call => \&auth);
hook(type => "formbuilder_setup", id => "openid",
call => \&formbuilder_setup, last => 1);
@ -20,6 +21,18 @@ sub getopt () { #{{{
GetOptions("openidsignup=s" => \$config{openidsignup});
} #}}}
sub getsetup () { #{{{
return
openidsignup => {
type => "string",
default => "",
example => "http://myopenid.com/",
description => "an url where users can signup for an OpenID",
safe => 1,
rebuild => 0,
},
} #}}}
sub formbuilder_setup (@) { #{{{
my %params=@_;

View File

@ -7,13 +7,30 @@ use strict;
use IkiWiki 2.00;
sub import { #{{{
hook(type => "formbuilder_setup", id => "passwordauth",
call => \&formbuilder_setup);
hook(type => "formbuilder", id => "passwordauth",
call => \&formbuilder);
hook(type => "getsetup", id => "passwordauth", "call" => \&getsetup);
hook(type => "formbuilder_setup", id => "passwordauth", call => \&formbuilder_setup);
hook(type => "formbuilder", id => "passwordauth", call => \&formbuilder);
hook(type => "sessioncgi", id => "passwordauth", call => \&sessioncgi);
} # }}}
sub getsetup () { #{{{
return
account_creation_password => {
type => "string",
default => "",
description => "a password that must be entered when signing up for an account",
safe => 1,
rebuild => 0,
},
password_cost => {
type => "integer",
default => 8,
description => "cost of generating a password using Authen::Passphrase::BlowfishCrypt",
safe => 1,
rebuild => 0,
},
} #}}}
# Checks if a string matches a user's password, and returns true or false.
sub checkpassword ($$;$) { #{{{
my $user=shift;

View File

@ -9,12 +9,24 @@ my %pages;
my $pinged=0;
sub import { #{{{
hook(type => "getsetup", id => "pinger", call => \&getsetup);
hook(type => "needsbuild", id => "pinger", call => \&needsbuild);
hook(type => "preprocess", id => "ping", call => \&preprocess);
hook(type => "delete", id => "pinger", call => \&ping);
hook(type => "change", id => "pinger", call => \&ping);
} # }}}
sub getsetup () { #{{{
return
pinger_timeout => {
type => "int",
default => 15,
description => "how many seconds to try pinging before timing out",
safe => 1,
rebuild => 0,
},
} #}}}
sub needsbuild (@) { #{{{
my $needsbuild=shift;
foreach my $page (keys %pagestate) {

View File

@ -40,9 +40,28 @@ sub default_timetable {
}
sub import { #{{{
hook(type => "getsetup", id => "getsetup", call => \&getsetup);
hook(type => "checkconfig", id => "prettydate", call => \&checkconfig);
} # }}}
sub getsetup () { #{{{
return
prettydateformat => {
type => "string",
default => '%X, %B %o, %Y',
description => "format to use to display date",
safe => 1,
rebuild => 1,
},
timetable => {
type => undef, # don't try to show in interface
default => '%X, %B %o, %Y',
description => "array of time descriptions",
safe => 1,
rebuild => 1,
},
} #}}}
sub checkconfig () { #{{{
if (! defined $config{prettydateformat} ||
$config{prettydateformat} eq '%c') {