PageLocking

Does PmWiki have some way of "locking pages" so that an author editing a page has exclusive access to the page?

PmWiki doesn't have edit locking, and doesn't need it. If two or more people edit the same page at the same time, PmWiki will detect that this has happened and merge their changes together into a single document. It will also mark any conflicting edits and give an author an opportunity to review the resulting merged document before saving. This is generally a superior approach to page locking.

For those who may be interested, the rest of this page describes reasons why page locking is difficult and doesn't really work in a wiki/web context.

The normal meaning of "page locking" with wiki edits is that when someone starts editing a page, then other people are not allowed to edit the page (the page is "locked") until the original person finishes their edits and hits the "submit" button to post their edits back to the system.

The problem on the web is that an author might never hit the "submit" button to release the page's lock. There are many ways in which an author could "abandon" the editing of a page--hit the "back" button, close their browser, computer or network shutdown/failure, etc. But for any of these, PmWiki has no real mechanism for knowing that this has occurred because these events all happen without any sort of notification being sent to the webserver. So, when an edit is abandoned, the page on the server remains locked against further edits, waiting for a submit (that will never come) before releasing the lock.

So, with any locking scheme there has to be a protocol available that allows PmWiki to determine when an edit has been abandoned and that the lock can be safely released. Some ideas for this have included:

  1. Allow locks to be automatically released after N minutes. Choosing a good value for N is tricky here--we want it to be long enough to cover the amount of time someone might spend in the page edit box. 30 minutes is probably a practical minimum. But this approach has some drawbacks--if someone clicks "Edit Page", and then immediately hits the back button or closes the browser, the page is now locked against edits for N more minutes. By storing cookies on the author's browser we could make it possible for the author requesting the edit to get past the lock, but this requires saving cookies, which some people don't like, and the page would still be locked to all other authors for those N minutes.
  2. Allow authors to override the lock. When an author hits "Edit Page" on a locked page, she receives a notification that the page is currently locked and have the option of continuing the edit even though it is locked. But Pm doesn't like this because it may deter or be confusing to naive authors, and it may give false signals that the page is locked for editing when it the edit was actually abandoned.

From the above you can see why merging simultaneous edits is a superior method to handling possible conflicts in editing: it simplifies the recordkeeping that PmWiki must perform, and (consistent with PmWikiPhilosophy #1) it's friendlier towards authors.

Category: PmWiki Design

This page may have a more recent version on pmwiki.org: PmWiki:PageLocking, and a talk page: PmWiki:PageLocking-Talk?.