From eaf59e5ba940b883814c19ae64e68dea4530d992 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 26 Jul 2009 16:33:12 +0100 Subject: [PATCH] getsource: run as plain CGI, rather than sessioncgi As I suggested when reviewing Will's code, calling loadindex() should be sufficient. --- IkiWiki/Plugin/getsource.pm | 7 ++++--- 1 file 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}));