Just to make it clear:
1) Retrieve the page, store last edit time as TIME
2) Do something what requires user input, possibly may last few minutes
3) Retrieve the page history
<< Possible race
condition here, what if someone edit the page before step 3 and 5
4) Compare time of last edit in page history with TIME in order to
check if page was edited
<< Possible race
condition here, what if someone edit the page before step 4 and 5
5) Edit
This is not what I need ^ I need something better :-)
On Wed, Jan 22, 2014 at 12:41 PM, Petr Bena <benapetr(a)gmail.com> wrote:
The title pretty much say what I need
1) Retrieve the page - page must not be changed starts NOW
2) Do something what requires user input, possibly may last few minutes
3) Save the page ONLY if it wasn't changed, if it was, go back to step 1
this all needs to be done using API, I thought that edit token would
help me here, so that I would fetch the token at step 1 and edit using
it at step 3, hoping it expire if someone edit the page meanwhile. But
this doesn't seem to work according to documentation, because edit
token is only changed when user logout.
Is there any super-safe and proper method to do this? Preferably
something more reliable than just storing the timestamp and comparing
it (in theory someone could edit the page even in short time when
timestamp is compared). I need some super-safe lock that prevent all
possible race conditions here.