diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2008-12-20 20:55:38 -0500 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2008-12-20 20:55:38 -0500 |
commit | c53a3a1d3e028e4f27acb661cc19341a13801c2b (patch) | |
tree | 451a69c476a4b2c9889762574e7689f60eadc868 | |
parent | 155ebc3dbdcb265d5afa61fd46b20bf2fd9387fb (diff) | |
download | ikiwiki-c53a3a1d3e028e4f27acb661cc19341a13801c2b.tar ikiwiki-c53a3a1d3e028e4f27acb661cc19341a13801c2b.tar.gz |
avoid storing transient state in pagestate
None of the comment state needs to be stored through the a later run of
ikiwiki, so move it all from pagestate to a more transient storage.
This is assuming that we'll never want to add pagespecs to search against
the comment state. Pagespecs like author() are why the meta plugin does
store its meta data in pagestate -- the data can be needed later to match
against.
-rw-r--r-- | IkiWiki/Plugin/comments.pm | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 4f3b76db3..644ef1be8 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -16,6 +16,7 @@ use constant POST_COMMENT => "Post comment"; use constant CANCEL => "Cancel"; my $postcomment; +my %commentstate; sub import { hook(type => "checkconfig", id => 'comments', call => \&checkconfig); @@ -152,7 +153,6 @@ sub preprocess { my $commentauthor; my $commentauthorurl; my $commentopenid; - if (defined $params{username}) { $commentuser = $params{username}; @@ -181,11 +181,11 @@ sub preprocess { $commentauthor = gettext("Anonymous"); } - $pagestate{$page}{comments}{commentuser} = $commentuser; - $pagestate{$page}{comments}{commentopenid} = $commentopenid; - $pagestate{$page}{comments}{commentip} = $commentip; - $pagestate{$page}{comments}{commentauthor} = $commentauthor; - $pagestate{$page}{comments}{commentauthorurl} = $commentauthorurl; + $commentstate{$page}{commentuser} = $commentuser; + $commentstate{$page}{commentopenid} = $commentopenid; + $commentstate{$page}{commentip} = $commentip; + $commentstate{$page}{commentauthor} = $commentauthor; + $commentstate{$page}{commentauthorurl} = $commentauthorurl; if (! defined $pagestate{$page}{meta}{author}) { $pagestate{$page}{meta}{author} = $commentauthor; } @@ -570,27 +570,27 @@ sub pagetemplate (@) { if ($template->query(name => 'commentuser')) { $template->param(commentuser => - $pagestate{$page}{comments}{commentuser}); + $commentstate{$page}{commentuser}); } if ($template->query(name => 'commentopenid')) { $template->param(commentopenid => - $pagestate{$page}{comments}{commentopenid}); + $commentstate{$page}{commentopenid}); } if ($template->query(name => 'commentip')) { $template->param(commentip => - $pagestate{$page}{comments}{commentip}); + $commentstate{$page}{commentip}); } if ($template->query(name => 'commentauthor')) { $template->param(commentauthor => - $pagestate{$page}{comments}{commentauthor}); + $commentstate{$page}{commentauthor}); } if ($template->query(name => 'commentauthorurl')) { $template->param(commentauthorurl => - $pagestate{$page}{comments}{commentauthorurl}); + $commentstate{$page}{commentauthorurl}); } } |