[Koha-bugs] [Bug 19306] Adding hooks to the plugin system

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Oct 22 13:11:52 CEST 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19306

--- Comment #5 from Stefan Berndtsson <stefan.berndtsson at ub.gu.se> ---
The way I see this there are three kinds of "plugins". This idea adds a fourth.

1. Report-plugin.
2. Tool-plugin.
3. "Normal" plugin.
4. "Hooks".

The normal plugin is meant to run once, in a very particular circumstance where
the result of the plugin isn't necessarily meant to be passed on to any other
plugin. An example here is the to_marc feature used when importing records.
Input can be CSV and output is MARC.

A hook on the other hand is meant to return data in the same format as it was
received, so that they are chainable. Multiple plugins can be available for the
same hook. An example for this case could be modifying MARC-data on its way to
the database (for those familiar with Rails, this would be similar to a
before_save hook), or adding extra fields into the index without changing the
data, in a before_index hook.

We currently use the latter in our Koha instance where we want to be able to
distinguish books from ebooks for example, where the qualification for these
come from multiple MARC fields. The plugin used for this looks at the
MARC-record, combines everything and adds a 998$a with the result which is then
indexed and searchable. Many such plugins could be chained in sequence for
different kinds of index-preparations.

It may therefor not be sensible to replace things all throughout the code, and
that 3 and 4 may need to live beside each other.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list