[dokuwiki] Changes in Anteater for plugin authors

  • From: Michael Hamann <michael@xxxxxxxxxxxxxxxx>
  • To: dokuwiki <dokuwiki@xxxxxxxxxxxxx>
  • Date: Wed, 02 Feb 2011 17:20:20 +0100

Dear plugin developers,

as I've helped Matthias Schulte a bit fixing some issues in the plugins
on the dokufreaks account I've noticed that there have been two changes in
the latest (stable) version that affect some of these plugins and as
these parts of the plugins that need(ed) to be changed are quite general
perhaps also your plugin(s) might be affected. The first change affects
plugins that save data in the handle() function of syntax plugins, the
second change the subscription handling.

1) handle() during save

The change is that handle() and render() are in most cases no longer
called during saving so relying on $ACT == 'save' doesn't work anymore.
The commit that changed this is
https://github.com/splitbrain/dokuwiki/commit/ee4d22e0a02a665a30a387ba95e614c22600862b
There are some relatively popular plugins like the task or discussion
plugin that are/were affected by this change.

So what do you need to change?

Some plugins like the tag plugin currently simply don't care for $ACT in
handle(). This is dangerous because handle() is called for old revisions
and previews so you are replacing the stored data with wrong data. So
this is no fix.

You can check for $ACT != 'preview' and that $REV is empty, then you
catch at least the old pages and the preview. I however don't know if
there are other scenarios where handle() could be called with
unsaved/old data.

The best fix is in my opinion to save the data during metadata rendering
because metadata is only rendered for current and saved pages. Metadata
rendering will happen also for unchanged pages, if this is an issue for
you you could add a check for the last modification time of the page, it
should be available in the metadata you can access via the renderer (and
e.g. store in the persistent metadata when you last saved your data).

2) subscriber lists

The function for getting the list of subscribers has been changed. The
old function subscriber_addresslist($ID) no longer exists and there is a
new function subscription_addresslist(). However please do not just
search and replace that function name as the parameters have been
changed, too. The new way for getting the subscribers is:

$data = array('id' => $ID, 'addresslist' => '', 'self' => false);
trigger_event('COMMON_NOTIFY_ADDRESSLIST', $data, 'subscription_addresslist');
$bcc = $data['addresslist'];

See http://www.dokuwiki.org/devel:event:common_notify_addresslist for
more information on this event and the $data array that event takes as
argument.

I hope this helps you discovering and fixing bugs with the Anteater
release. I hope we will manage to get a changelog for plugin developers
when the next release is done so you will get that information not just
three months after release or by following the development closely but
right when the first RC version is available (or even earlier).

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

Other related posts:

  • » [dokuwiki] Changes in Anteater for plugin authors - Michael Hamann