[geeklog-devel] RFC: Simplifying PLG_itemSaved

Website Master websitemaster at cogeco.net
Sat Jan 17 12:49:32 EST 2009

Sounds good,

How about a PLG_itemDelete, PLG_itemEdit  which will notify plugins and
Geeklog about delete or edits of stories and other plugins objects. As
example with the rating plugin it would be nice to delete any ratings
associated with a story or some other plugin object automatically.

While we are the topic some mods to PLG_getItemInfo would be helpful in the
future. Along with information like:
'url' - the complete URL of the item 
'title' - the item's title or subject 
'excerpt' - a short description of the item 
'description' - the full description of the item, e.g. the article text

some plugins also need information about what table the plugin object(s) is
stored in, the name of the id field(s) and security information. Also some
plugins have multiple object types, the current API does not handle this. As
example the forum has topics and messages.

Also it would be a good idea to get the Universal Plugin Toolkit up to speed
once everything has been figured out so people know about these APIs (along
with the core plugins).



-----Original Message-----
From: geeklog-devel-bounces at lists.geeklog.net
[mailto:geeklog-devel-bounces at lists.geeklog.net] On Behalf Of Dirk Haun
Sent: January-17-09 11:57 AM
To: geeklog-devel
Cc: Geeklog Modules List
Subject: [geeklog-devel] RFC: Simplifying PLG_itemSaved

This is the third (and last, I promise) Request For Comments on plugin
API changes for Geeklog 1.6. I'm still interested in any feedback on my
previous two, regarding Plugin auto install[1] and Plugin migration[2].

Almost 4 years ago[3], Blaine and myself came up with the idea for
PLG_itemSaved. The hope was to provide an API into which plugins could
hook and that would inform them whenever something was saved in Geeklog,
so that they could act on it.

Part of the concept was an abort and rollback mechanism, where plugins
could report an error and signal to Geeklog (and other plugins) that
there was a problem and that the save operation should be aborted. In
which case the user would be taken back to the editor where s/he was
informed of the problem and could try again.

Fast-forward four years and that mechanism has only been implemented for
stories. And, looking at the code (in 1.4 and 1.5), not even been
implemented correctly. And it hasn't caught on either (i.e. isn't being
used by any plugins, to the best of my knowledge). Neither has it been
implemented anywhere else.

Why is that? I think it's because the API is too complicated. Namely,
the abort and rollback isn't really needed.

My suggestion would be: Get rid of the abort. When something is saved (a
story, a static page, etc.), it calls PLG_itemSaved. Plugins interested
in that information can still hook into it, but they can no longer abort
the process (why should a plugin be able to tell Geeklog - and the user
- that a story should not be saved anyway?).

Over the years, we had a lot of scenarios where something like
PLG_itemSaved (implemented everywhere) would have come in handy. I think
it's time we finally do that. And if the complexity of the API is
holding us back here, then we need to fix that.

I realize there's also PLG_itemPreSave, which is supposed to be called
before the save, and which _can_ cause an abort. We should keep that and
implement it everywhere, too, so that every call to PLG_itemSaved is
preceded by a call to PLG_itemPreSave. That should handle situations
where plugins still want to abort, for whatever reason. Only then it
would happen before the object ended up in the database, which gets rid
of the rollback and makes things much easier.


bye, Dirk

[1] <http://eight.pairlist.net/pipermail/geeklog-devel/2009-January/
[2] <http://eight.pairlist.net/pipermail/geeklog-devel/2009-January/
[3] <http://eight.pairlist.net/pipermail/geeklog-devel/2005-February/


geeklog-devel mailing list
geeklog-devel at lists.geeklog.net

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3773 (20090117) __________

The message was checked by ESET NOD32 Antivirus.


More information about the geeklog-devel mailing list