[pmwiki-devel] bug in RestorePage()?

Daniel Roesler diafygi at gmail.com
Mon Apr 13 13:29:50 CDT 2009


On Sat, Apr 11, 2009 at 7:19 PM, Petko Yotov <5ko at 5ko.fr> wrote:
> $restore is also something like this: "diff:1234437773:1234437713".

Right, but I think Mr. Bowers' point was that this is not documented
well. If you were going to take advantage of the RestorePage()
function in a recipe (indeed, I'm working on one now), you would have
to know that the $restore variable has to have the "diff:" in front of
the timestamp to be compared correctly.

Also, it's important to note that the RestorePage() function restores
the edit previous to the timestamp. For example, if you have an edit
where you add some text "xxyyzz" at 11223344 timestamp, then add some
more text "aabbcc" at 22334455 timestamp. Calling the function
RestorePage($pagename, $page, $new, $restore), where $restore is
"diff:22334455", will return "xxyyzz" (without "aabbcc").

This is fine for the use in PmWiki's core edit functions, since
RestorePage is used to undo edits (i.e. go to the previous version).
However, it's a bit unintuitive when you call a RestorePage() with a
certain timestamp, then get back a version with a previous timestamp.
I'm not saying it should be changed. I just think it's a bit quirky. I
basically have to add a second onto my timestamps when using this
function to get the correct edit.

Avast!
Daniel Roesler
diafygi at gmail.com

On Sat, Apr 11, 2009 at 7:19 PM, Petko Yotov <5ko at 5ko.fr> wrote:
> On Friday 10 April 2009 20:42:03 Peter Bowers wrote:
>> However, it appears that the $page array must be read in with a $since
>> of the same value as the $restore value or else RestorePage() doesn't
>> work.
>>
>> Specifically this line in RestorePage() appears to be in error:
>>
>>     if ($k<$restore) break;
>>
>> This appears to be trying to compare a timestamp with the desired
>> timestamp and not processing any more if we have passed the desired
>> timestamp.  However, the key to this hash is actually
>> "diff:12341234:23452345" rather than just 12341234.  Thus $k is
>> "diff:12341234:23452345" and that is being compared to $restore which
>> is "12341234".
>
> $restore is also something like this: "diff:1234437773:1234437713".
>
> Thanks,
> Petko
>
> _______________________________________________
> pmwiki-devel mailing list
> pmwiki-devel at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-devel
>



More information about the pmwiki-devel mailing list