1

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)

Voriki
  • 1,617
  • 2
  • 19
  • 43

2 Answers2

3

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

gac410
  • 101
  • 3
1

The following isn't(!) the right solution (sure exists an nice Foswiki-way approach), but if you know perl, you can do anything with the:

  1. Install Firefox
  2. install MozRepl addon into it
  3. Install the WWW::Mechanize::Firefox perl module

Now, you can script anything what you can do directly from the browser, e.g. logging into the Foswiki, click buttons, save topics, etc..etc. Drawback - it isn't an easy way - you need to know many details.

Myself using this technique for testing.

clt60
  • 62,119
  • 17
  • 107
  • 194