Tags:
create new tag
, view all tags

Question

Hi, I need to create / modify TWiki pages programatically. I can see the way they are made of just text files, so it seems easy to do the actual edit, but I would presume that it would be a good idea to have the page locked before the program tries to make changes. How would I do this please ? Execute a shell command to lock the page ?

Environment

TWiki version: TWikiRelease02Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: N/A
Web server: N/A
Perl version: N/A
Client OS: N/A
Web Browser: N/A
Categories: Add-Ons

-- CliveGalway - 23 Jun 2005

Answer

you may want to take a look at CPAN:WWW::Mechanize::TWiki which translates perl function calls into URIs which simulate a web browser. note that if you simply manually create the .txt files, this will break if/when there are alternate storage backends, eg, subversion or a database

-- WillNorris - 23 Jun 2005

Will is right, access over http is your safest bet.

As a hack, if you want to manipulate the files directly you could lock the files programmatically on the server. Assuming you want to lock Sandbox.FooBar, check/create/manipulate the data/Sandbox/FooBar.lock file. Example content:

PaulSmith
1122932341

The first line is the login user, the second line is the lock timestamp (Unix epoc time).

Note that this hack works just for the current production release. The lock algorithm changes in the DakarRelease.

-- PeterThoeny - 02 Aug 2005

 
Topic revision: r4 - 2005-08-02 - WillNorris
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.