Bug 41684 - notices_content hook is not checking if individual plugins are enabled and is reloading plugins
Summary: notices_content hook is not checking if individual plugins are enabled and is...
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Plugin architecture (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-01-22 12:43 UTC by Nick Clemens (kidclamp)
Modified: 2026-01-23 04:38 UTC (History)
4 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 41684: Make `notices_content` hook be used with `get_enabled_plugins()` (2.39 KB, patch)
2026-01-22 19:24 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 41684: Make `notices_content` hook be used with `get_enabled_plugins()` (2.42 KB, patch)
2026-01-23 04:38 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2026-01-22 12:43:26 UTC
Bug 39870 added a new hook 'notices_content'

When searching for plugins, however, this hook does not check whether the plugin is enabled or not

Additionally, since not using Koha::Plugins->call or get_enabled_plugins, this is loading the plugin code again and breaking transactions as we have done in other places.
Comment 1 Tomás Cohen Arazi (tcohen) 2026-01-22 19:24:12 UTC
Created attachment 191885 [details] [review]
Bug 41684: Make `notices_content` hook be used with `get_enabled_plugins()`

This patch makes the plugin hook load plugins using `get_enabled_plugins()`. This has
the immediate effect of using the already cached plugin objects without reinstantiating them.

This way transactions don't get broken for schema reloads. Also, only enabled plugins
are loaded/attempted to be loaded.

To test:
1. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Plugins/Notices_content_hook.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass: fundamental behavior remains unchanged.
4. Sign off :-D

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Comment 2 David Nind 2026-01-23 04:38:44 UTC
Created attachment 191892 [details] [review]
Bug 41684: Make `notices_content` hook be used with `get_enabled_plugins()`

This patch makes the plugin hook load plugins using `get_enabled_plugins()`. This has
the immediate effect of using the already cached plugin objects without reinstantiating them.

This way transactions don't get broken for schema reloads. Also, only enabled plugins
are loaded/attempted to be loaded.

To test:
1. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Plugins/Notices_content_hook.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass: fundamental behavior remains unchanged.
4. Sign off :-D

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>