Bug 41651

Summary: Allow plugins to specify additional dependencies
Product: Koha Reporter: HKS3 Tadeusz Sośnierz <tadeusz>
Component: Plugin architectureAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: lisette
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 41651: Allow plugins do specify dependencies, abort installation if unmet

Description HKS3 Tadeusz Sośnierz 2026-01-16 14:11:16 UTC
Koha plugins cannot currently declare any dependencies. Not meeting them will occcasionally fail upon installation (if the main plugin class tries to load them at compile time) or runtime (if one of the other packages does, or code cleverly checks if the dependency is met).

Ideally we'd have a way of specifying if a Koha plugin depends on another Perl module, or another Koha plugin. A nice feature of this would be to able be able to declare optional dependencies, which may only be required for a subset of the Plugin's features (like in https://github.com/HKS3/koha-normalize-marc2db/blob/main/Koha/Plugin/HKS3/NormalizeMARC2DB/Jobs/VerifyAll.pm#L34). Those shouldn't prevent installation, but should still warn loudly upon plugin installation, in a way that is hard/impossible to miss (e.g. have an intermitted screen on plugins-upload.pl, with an "are you sure").

Patch incoming.
Comment 1 HKS3 Tadeusz Sośnierz 2026-01-16 14:14:39 UTC
Created attachment 191567 [details] [review]
Bug 41651: Allow plugins do specify dependencies, abort installation if unmet

This approach uses a new $metadata key, to minimize the scope of changes needed.
The downside of that is the fact that if the base plugin package requires
those dependencies in compile-time already, the code (and thus metadata itself)
will fail to load in an unhandled way.

plugins-upload.pl can't know for sure whether it's really the plugin being installed
that doesn't have its dependencies met, which is a limitation to how it currently works.