X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/702b8721d360ca132ff5c8f43d332757694b98da..92951e2c3eecbbbb2af4244df13c32a6a032d5ad:/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm index 3803bb917..5f7bdfd06 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -30,7 +30,7 @@ sub defaultconfig () { #{{{ wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.x?html?$|\.rss$|\.atom$|.arch-ids/|{arch}/)}, wiki_link_regexp => qr/\[\[(?:([^\]\|]+)\|)?([^\s\]]+)\]\]/, wiki_file_regexp => qr/(^[-[:alnum:]_.:\/+]+$)/, - web_commit_regexp => qr/^web commit (by (.*?(?=: )|[^:]+)|from (\d+\.\d+\.\d+\.\d+)):?(.*)/, + web_commit_regexp => qr/^web commit (by (.*?(?=: |$))|from (\d+\.\d+\.\d+\.\d+)):?(.*)/, verbose => 0, syslog => 0, wikiname => "wiki", @@ -62,7 +62,7 @@ sub defaultconfig () { #{{{ setup => undef, adminuser => undef, adminemail => undef, - plugin => [qw{mdwn inline htmlscrubber}], + plugin => [qw{mdwn inline htmlscrubber passwordauth}], timeformat => '%c', locale => undef, sslcookie => 0, @@ -116,13 +116,8 @@ sub checkconfig () { #{{{ } #}}} sub loadplugins () { #{{{ - foreach my $plugin (@{$config{plugin}}) { - my $mod="IkiWiki::Plugin::".possibly_foolish_untaint($plugin); - eval qq{use $mod}; - if ($@) { - error("Failed to load plugin $mod: $@"); - } - } + loadplugin($_) foreach @{$config{plugin}}; + run_hooks(getopt => sub { shift->() }); if (grep /^-/, @ARGV) { print STDERR "Unknown option: $_\n" @@ -131,6 +126,16 @@ sub loadplugins () { #{{{ } } #}}} +sub loadplugin ($) { #{{{ + my $plugin=shift; + + my $mod="IkiWiki::Plugin::".possibly_foolish_untaint($plugin); + eval qq{use $mod}; + if ($@) { + error("Failed to load plugin $mod: $@"); + } +} #}}} + sub error ($) { #{{{ if ($config{cgi}) { print "Content-type: text/html\n\n"; @@ -663,7 +668,15 @@ sub run_hooks ($$) { # {{{ my $sub=shift; if (exists $hooks{$type}) { + my @deferred; foreach my $id (keys %{$hooks{$type}}) { + if ($hooks{$type}{$id}{last}) { + push @deferred, $id; + next; + } + $sub->($hooks{$type}{$id}{call}); + } + foreach my $id (@deferred) { $sub->($hooks{$type}{$id}{call}); } }