diff options
author | Simon McVittie <smcv@ http://smcv.pseudorandom.co.uk/> | 2009-07-26 16:33:12 +0100 |
---|---|---|
committer | Simon McVittie <smcv@ http://smcv.pseudorandom.co.uk/> | 2009-07-26 16:33:12 +0100 |
commit | eaf59e5ba940b883814c19ae64e68dea4530d992 (patch) | |
tree | 0b2e7bab81ca29d8badf0e4b22bca8118f109853 /IkiWiki/Plugin/getsource.pm | |
parent | 01e4cb1464d07afb22d22bf98116a3ed9126612b (diff) | |
download | ikiwiki-eaf59e5ba940b883814c19ae64e68dea4530d992.tar ikiwiki-eaf59e5ba940b883814c19ae64e68dea4530d992.tar.gz |
getsource: run as plain CGI, rather than sessioncgi
As I suggested when reviewing Will's code, calling loadindex() should be
sufficient.
Diffstat (limited to 'IkiWiki/Plugin/getsource.pm')
-rw-r--r-- | IkiWiki/Plugin/getsource.pm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/IkiWiki/Plugin/getsource.pm b/IkiWiki/Plugin/getsource.pm index 4e74eaea0..2e65df950 100644 --- a/IkiWiki/Plugin/getsource.pm +++ b/IkiWiki/Plugin/getsource.pm @@ -9,7 +9,7 @@ use open qw{:utf8 :std}; sub import { hook(type => "getsetup", id => "getsource", call => \&getsetup); hook(type => "pagetemplate", id => "getsource", call => \&pagetemplate); - hook(type => "sessioncgi", id => "getsource", call => \&cgi_getsource); + hook(type => "cgi", id => "getsource", call => \&cgi_getsource); } sub getsetup () { @@ -39,9 +39,8 @@ sub pagetemplate (@) { } } -sub cgi_getsource ($$) { +sub cgi_getsource ($) { my $cgi=shift; - my $session=shift; # Note: we use sessioncgi rather than just cgi # because we need $IkiWiki::pagesources{} to be @@ -54,6 +53,8 @@ sub cgi_getsource ($$) { my $page=$cgi->param('page'); + IkiWiki::loadindex(); + if ($IkiWiki::pagesources{$page}) { my $data = IkiWiki::readfile(IkiWiki::srcfile($IkiWiki::pagesources{$page})); |