getsource: run as plain CGI, rather than sessioncgi

As I suggested when reviewing Will's code, calling loadindex() should be
sufficient.
master
Simon McVittie 2009-07-26 16:33:12 +01:00
parent 01e4cb1464
commit eaf59e5ba9
1 changed files with 4 additions and 3 deletions

View File

@ -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}));