Item1557: PublishPlugin cannot be run from shell

Priority: Normal
Current State: Closed
Released In:
Target Release: minor
Applies To: Extension
Component: PublishPlugin
Reported By: MarcSCHAEFER
Waiting For:
Last Change By: CrawfordCurrie
Please modify PublishPlugin as follows in SVN ( 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/
    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};
            -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

ItemTemplate edit

Summary PublishPlugin cannot be run from shell
ReportedBy MarcSCHAEFER
Codebase 1.0.5, 1.0.4
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Extension
Component PublishPlugin
Priority Normal
CurrentState Closed
Checkins PublishPlugin:6a2c48aa062f
TargetRelease minor
Topic revision: r5 - 18 May 2009, CrawfordCurrie - This page was cached on 15 Feb 2018 - 18:53.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License