Search code examples
wikifoswiki

Foswiki: Uploading and downloading topics without FTP


I have a Foswiki wiki on a server. Is it possible to script the following without FTP access (for various reasons I can't use it):

  1. Download a topic's wikitext, modify it locally, then upload it again (overwriting the topic)

  2. Upload wikitext to a new topic

I've been doing these tasks manually, but I'd like to automate them. I've looked into the Foswiki API and a few plugins, but nothing seems capable of doing this.

Is there a way? (any programming language)


Solution

  • If you have web access, you could drive the bin/view and bin/save scripts remotely from a script.

    Take a look at our BuildContrib upload target for an example. It gets a strikeone key and downloads the original topic to recover any form data. It then uploads the topic text, creating a new version. It's written in perl, and uses LWP.

    https://github.com/foswiki/distro/blob/master/BuildContrib/lib/Foswiki/Contrib/BuildContrib/Targets/upload.pm