Item1557: PublishPlugin cannot be run from shell
Priority: Normal
Current State: Closed
Released In:
Target Release: minor
Please modify
PublishPlugin as follows in SVN (
http://foswiki.org/Extensions/PublishPlugin#Publishing_from_the_command_line). The doc is wrong.
Publishing from the command line
Just
cd
to the
bin
directory, and
perl -wT rest /PublishPlugin/publish -web=Book format=file
. Parameters are passed as -name value pairs, for example:
perl -T rest /PublishPlugin/publish -web Book -exclusions 'Web*' -format file
perl -T rest /PublishPlugin/publish -web Book -inclusions WebBook -format pdf -genopt '--book --duplex --toclevels=5'
The available parameter names are shown in the publish form above, in the last column.
CORRECT command for below:
su - www-data -s /bin/bash -c 'cd /usr/lib/cgi-bin/foswiki && perl -wT rest /PublishPlugin/publish -web Main -format file'
If I start
PublishPlugin from command line:
su - www-data -s /bin/bash -c 'cd /usr/lib/cgi-bin/foswiki && perl -T rest topic=PublishPlugin/publish web=Main format=file'
I get:
ERROR: (400) Invalid REST invocationERROR: (400) Invalid REST invocation
Looking at lib/Foswiki/UI/Rest.pm:
my $pathInfo = $query->path_info();
# Foswiki rest invocations are defined as having a subject (pluginName)
# and verb (restHandler in that plugin)
unless ( $pathInfo =~ m#/(.*?)[./]([^/]*)# ) {
my $res = $session->{response};
$res->header(
-type => 'text/html',
-status => '400'
);
$res->print("ERROR: (400) Invalid REST invocation");
throw Foswiki::EngineException( 401,
"ERROR: (400) Invalid REST invocation", $res );
}
it seems the path_info() is wrong. Infact it is not set. I would assume pathInfo is simply the URL, and it tries to extract
PublishPlugin and publish, however this is obviously not set through a shell invocation.
Before I start a painful understanding of REST, has anyone any idea ?
thank you.
Doc fixed
--
CrawfordCurrie - 16 May 2009