summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/CGI.pm5
-rw-r--r--IkiWiki/Plugin/poll.pm6
2 files changed, 4 insertions, 7 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index c8c1b63dd..3f588e427 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -539,10 +539,6 @@ sub cgi_editpage ($$) { #{{{
# may have been committed while the post-commit hook was
# disabled.
require IkiWiki::Render;
- # Reload index, since the first time it's loaded is before
- # the wiki is locked, and things may have changed in the
- # meantime.
- loadindex();
refresh();
saveindex();
@@ -616,6 +612,7 @@ sub cgi (;$$) { #{{{
# Need to lock the wiki before getting a session.
lockwiki();
+ loadindex();
if (! $session) {
$session=cgi_getsession($q);
diff --git a/IkiWiki/Plugin/poll.pm b/IkiWiki/Plugin/poll.pm
index 63c93c62d..a5727fc8e 100644
--- a/IkiWiki/Plugin/poll.pm
+++ b/IkiWiki/Plugin/poll.pm
@@ -7,7 +7,7 @@ use IkiWiki 2.00;
sub import { #{{{
hook(type => "preprocess", id => "poll", call => \&preprocess);
- hook(type => "cgi", id => "poll", call => \&cgi);
+ hook(type => "sessioncgi", id => "poll", call => \&sessioncgi);
} # }}}
sub yesno ($) { #{{{
@@ -74,8 +74,9 @@ sub preprocess (@) { #{{{
return "<div class=poll>$ret</div>";
} # }}}
-sub cgi ($) { #{{{
+sub sessioncgi ($) { #{{{
my $cgi=shift;
+ my $session=shift;
if (defined $cgi->param('do') && $cgi->param('do') eq "poll") {
my $choice=$cgi->param('choice');
if (! defined $choice) {
@@ -92,7 +93,6 @@ sub cgi ($) { #{{{
# Did they vote before? If so, let them change their vote,
# and check for dups.
- my $session=IkiWiki::cgi_getsession();
my $choice_param="poll_choice_${page}_$num";
my $oldchoice=$session->param($choice_param);
if (defined $oldchoice && $oldchoice eq $choice) {