X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/506bcbac0420a46997ad531961d543e62c011513..21f44880cdd8f23264b2416bf39793aadcb87df6:/IkiWiki/Plugin/external.pm?ds=sidebyside diff --git a/IkiWiki/Plugin/external.pm b/IkiWiki/Plugin/external.pm index e3504a30d..8d1baa587 100644 --- a/IkiWiki/Plugin/external.pm +++ b/IkiWiki/Plugin/external.pm @@ -20,7 +20,8 @@ sub import { #{{{ return unless defined $plugin; my ($plugin_read, $plugin_write); - my $pid = open2($plugin_read, $plugin_write, $plugin); + my $pid = open2($plugin_read, $plugin_write, + IkiWiki::possibly_foolish_untaint($plugin)); # open2 doesn't respect "use open ':utf8'" binmode($plugin_read, ':utf8'); @@ -107,6 +108,7 @@ sub rpc_call ($$;@) { #{{{ } #}}} package IkiWiki::RPC::XML; +use Memoize; sub getvar ($$$) { #{{{ my $plugin=shift; @@ -130,6 +132,24 @@ sub setvar ($$$;@) { #{{{ return $ret; } #}}} +sub getstate ($$$$) { #{{{ + my $plugin=shift; + my $page=shift; + my $id=shift; + my $key=shift; + + return $IkiWiki::pagestate{$page}{$id}{$key}; +} #}}} + +sub setstate ($$$$;@) { #{{{ + my $plugin=shift; + my $page=shift; + my $id=shift; + my $key=shift; + + return $IkiWiki::pagestate{$page}{$id}{$key}=@_; +} #}}} + sub inject ($@) { #{{{ # Bind a given perl function name to a particular RPC request. my $plugin=shift; @@ -142,6 +162,7 @@ sub inject ($@) { #{{{ IkiWiki::Plugin::external::rpc_call($plugin, $params{call}, @_) }; eval qq{*$params{name}=\$sub}; + memoize($params{name}) if $params{memoize}; return 1; } #}}}