From: Simon McVittie Date: Sun, 26 Jul 2009 15:33:12 +0000 (+0100) Subject: getsource: run as plain CGI, rather than sessioncgi X-Git-Tag: 3.15~18^2~8 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/eaf59e5ba940b883814c19ae64e68dea4530d992?ds=inline getsource: run as plain CGI, rather than sessioncgi As I suggested when reviewing Will's code, calling loadindex() should be sufficient. --- 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}));