getsource: run as plain CGI, rather than sessioncgi
As I suggested when reviewing Will's code, calling loadindex() should be sufficient.master
parent
01e4cb1464
commit
eaf59e5ba9
|
@ -9,7 +9,7 @@ use open qw{:utf8 :std};
|
||||||
sub import {
|
sub import {
|
||||||
hook(type => "getsetup", id => "getsource", call => \&getsetup);
|
hook(type => "getsetup", id => "getsource", call => \&getsetup);
|
||||||
hook(type => "pagetemplate", id => "getsource", call => \&pagetemplate);
|
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 () {
|
sub getsetup () {
|
||||||
|
@ -39,9 +39,8 @@ sub pagetemplate (@) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub cgi_getsource ($$) {
|
sub cgi_getsource ($) {
|
||||||
my $cgi=shift;
|
my $cgi=shift;
|
||||||
my $session=shift;
|
|
||||||
|
|
||||||
# Note: we use sessioncgi rather than just cgi
|
# Note: we use sessioncgi rather than just cgi
|
||||||
# because we need $IkiWiki::pagesources{} to be
|
# because we need $IkiWiki::pagesources{} to be
|
||||||
|
@ -54,6 +53,8 @@ sub cgi_getsource ($$) {
|
||||||
|
|
||||||
my $page=$cgi->param('page');
|
my $page=$cgi->param('page');
|
||||||
|
|
||||||
|
IkiWiki::loadindex();
|
||||||
|
|
||||||
if ($IkiWiki::pagesources{$page}) {
|
if ($IkiWiki::pagesources{$page}) {
|
||||||
|
|
||||||
my $data = IkiWiki::readfile(IkiWiki::srcfile($IkiWiki::pagesources{$page}));
|
my $data = IkiWiki::readfile(IkiWiki::srcfile($IkiWiki::pagesources{$page}));
|
||||||
|
|
Loading…
Reference in New Issue