[Koha-bugs] [Bug 30410] Add a way for plugins to register background tasks

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Apr 11 17:34:30 CEST 2022


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

Martin Renvoize <martin.renvoize at ptfs-europe.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #132815|0                           |1
        is obsolete|                            |

--- Comment #8 from Martin Renvoize <martin.renvoize at ptfs-europe.com> ---
Created attachment 133181
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=133181&action=edit
Bug 30410: Add a way for plugins to expose tasks they implement

This patch implements a mechanism for plugins to tell Koha they
implement background jobs, by returning a mapping

```
    task => class
```

* _task_ is a string that will be used when queueing new tasks, to let
  the workers know which class to instantiate to launch the job (a.k.a.
  process).

* _class_ is a string for a class name.

For this to  work, plugins need to include the 'namespace' attribute in
their metadata. If they don't, they will be skipped when listing the
valid _background jobs_.

After this, high-level methods for letting plugins (easily) enqueue
their tasks will be provided.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Plugins/BackgroundJob.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen at theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize at ptfs-europe.com>

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


More information about the Koha-bugs mailing list