[dokuwiki] saving non-changing edits (was: better way?)

Hi,

> In the publish plugin, http://www.dokuwiki.org/plugin:publish
>
> it suggests something like:
>
> <snip>a core modification to save edits even if the page's content wasn't 
> changed in the edit</snip>
>
> Is there a better way (something that might be acceptable upstream)?
> I couldn't see an event that could be used for this...

Hmm complicated. Let's have a deeper look at how the publish plugin works first:

Privileged users (with AUTH_DELETE permissions) get an "approve this"
checkbox in the edit form when editing any page in a namespace set up
for approval. The usual workflow is that a less privileged minion
writes a page, then the more privileged overlord clicks edit, finds it
to be good as is and checks the checkbox and clicks save.

Now the publish plugin intercepts  the IO_WIKIPAGE_WRITE event to know
when a page was saved. It will then add the approval to the page's
metadata. But as the name suggest, the IO_WIKIPAGE_WRITE is only
called when a page is really written. But saveWikiText() aborts the
save when there was no change to the page content and
IO_WIKIPAGE_WRITE never happens.

First, I believe in general it makes sense NOT to store a new page
revision when no content was changed. So IMHO we should see if the
publish plugin could be changed. The plugin doesn't really care if
there is a new revision or not, it basically just signs the most
recent revision anyway (because metatdata always refers to the current
revision). And it doesn't need any special event data, just the
current page which is in $ID and the currently loggend in user which
is superglobal anyway.

So any event that happens after pressing the save button and after a
possible page change (eg. IO_WIKIPAGE_WRITE, because the overlord
might change something while approving) but before the redirect to the
do=show action happens, would be good.

Unfortunately there seems to be no such event that god be used
directly. One way would be introducing an event wrapper around
saveWikiText(). Maybe others could chime in if that would be
desirable.

But there's another way. The plugin could do the follwoing:

1st hook into ACTION_ACT_PREPROCESS.BEFORE and remember what action
was initially submitted (we only care for 'save')

2nd hook into ACTION_SHOW_REDIRECT.BEFORE and check if a 'save' was
remembered before. If yes do the approval thing before redirecting.

Any comments? Did I miss something?

Andi

-- 
splitbrain.org
-- 
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: