Bug 35603 - Add plugin feature to allow plugins to warn if any external library modules needed are missing
Summary: Add plugin feature to allow plugins to warn if any external library modules n...
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Plugin architecture (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Kyle M Hall
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-19 14:25 UTC by Kyle M Hall
Modified: 2024-05-01 13:51 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 35603: Add plugin feature to allow plugins to warn if any external library modules needed are missing (4.96 KB, patch)
2023-12-19 14:31 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 35603: Add plugin feature to allow plugins to warn if any external library modules needed are missing (5.02 KB, patch)
2023-12-19 16:30 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35603: (follow-up) Fix colspan count (1.54 KB, patch)
2023-12-19 16:30 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35603: Add plugin feature to allow plugins to warn if any external library modules needed are missing (5.03 KB, patch)
2024-05-01 13:51 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall 2023-12-19 14:25:34 UTC
Some plugins require extra modules not included with Koha, but there is no simple way to let a user know when installing a plugin.
Comment 1 Kyle M Hall 2023-12-19 14:31:02 UTC
Created attachment 160008 [details] [review]
Bug 35603: Add plugin feature to allow plugins to warn if any external library modules needed are missing

Some plugins require extra modules not included with Koha, but there is no simple way to let a user know when installing a plugin.

This patch allows a new metadata to be added that is a list of hashes
with the key module. The hash is used for future expansion to allow new
critera to be added such as minimum and maximum module version.

Test Plan:
1) Install any plugin
2) In the plugin metadata, add the following key:
libs => [ { module => 'Business::Barcode::EAN13' } ],
3) Apply this patch
4) Restart all the things!
5) Browse to plugins-home.pl, note the error listing the missing module
6) Install Business::Barcode::EAN13 from cpan
7) Reload the page
8) Note the error is gone!
Comment 2 Martin Renvoize 2023-12-19 16:30:25 UTC
Created attachment 160036 [details] [review]
Bug 35603: Add plugin feature to allow plugins to warn if any external library modules needed are missing

Some plugins require extra modules not included with Koha, but there is no simple way to let a user know when installing a plugin.

This patch allows a new metadata to be added that is a list of hashes
with the key module. The hash is used for future expansion to allow new
critera to be added such as minimum and maximum module version.

Test Plan:
1) Install any plugin
2) In the plugin metadata, add the following key:
libs => [ { module => 'Business::Barcode::EAN13' } ],
3) Apply this patch
4) Restart all the things!
5) Browse to plugins-home.pl, note the error listing the missing module
6) Install Business::Barcode::EAN13 from cpan
7) Reload the page
8) Note the error is gone!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 3 Martin Renvoize 2023-12-19 16:30:27 UTC
Created attachment 160037 [details] [review]
Bug 35603: (follow-up) Fix colspan count

This isn't directly related to the bug, but was apparent whilst testing.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2023-12-19 16:33:48 UTC
Testing using my in-development crontab plugin with a 'conditional_load' branch: https://github.com/PTFS-Europe/koha-plugin-crontab/tree/conditional_load

I'm catching the missing module during the install method and returning false there. This allows plugin_methods to be properly set and the plugin files to remain on the system whilst preventing the __INSTALLED__ flag being set.

This means that whilst the plugin seen by Koha, it's marked with an error and displays the missing module information.. once the module is installed, the install sub runs to completion and the plugin works as expected :)
Comment 5 Kyle M Hall 2024-05-01 13:51:05 UTC
Created attachment 165975 [details] [review]
Bug 35603: Add plugin feature to allow plugins to warn if any external library modules needed are missing

Some plugins require extra modules not included with Koha, but there is no simple way to let a user know when installing a plugin.

This patch allows a new metadata to be added that is a list of hashes
with the key module. The hash is used for future expansion to allow new
critera to be added such as minimum and maximum module version.

Test Plan:
1) Install any plugin
2) In the plugin metadata, add the following key:
libs => [ { module => 'Business::Barcode::EAN13' } ],
3) Apply this patch
4) Restart all the things!
5) Browse to plugins-home.pl, note the error listing the missing module
6) Install Business::Barcode::EAN13 from cpan
7) Reload the page
8) Note the error is gone!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>