[pmwiki-users] RFC: Drafts history bug

Petko Yotov 5ko at 5ko.fr
Wed Jul 10 09:15:00 CDT 2013

Sorry if the message is a little technical, please ignore it if it doesn't  
concern you.

A user has demonstrated a bug [1][2] when a page is modified and saved as  
draft, then modified and published, then reverted to the pre-draft version:  
the restore is incorrect, wrong lines are restored and duplicated, good  
lines are missing.

The problem appears because when a "draft" is "published", the diff is  
created not between the previous version of the "draft" and the posted text  
(A), but between the previous version of the "published" page and the posted  
text (B), while the page history contains diffs from the draft versions (and  
not from the published versions).

Because of this, restoring from a previous version other than the very last  
one, in some cases is incorrect.

At the moment in the Subversion pre-release I have commented out a line  
where PmWiki switches the old version of the draft page with the public  
page. (In scripts/draft.php, line 59 commented out.)

With the current solution (A), it appears really fixed but I'm still  
searching for any potential negative side effects (I don't see any but I  
wonder why it was done this way in the past). This solution keeps  
information in the page history for the authors of the changes, including  
the draft changes.

There is another possible solution: (B) done correctly, slightly more complex  
to implement: discard all edit history from the draft page and only store  
the diff between the published page and the posted text, keeping only the  
history of the published versions. This will not break the restore mecanism.  
OTOH, this will lose information about authors of intrermediate edits and  
one can wonder if it is ethical.

My questions are:

1. Does anyone see a problem with the current solution (A) ?

2. Should we go with (A) or (B) ? Or something else?


[1] http://www.pmwiki.org/wiki/Test/DraftRestore
[2] http://www.pmwiki.org/wiki/PITS/01007

More information about the pmwiki-users mailing list