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
--
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