Bug 37872: Add guards for enable_plugins

There are ILL-backends that are not implemented as
Koha plugins and does not require plugins to be enabled.

The 'new' method in Koha::Plugins returns undefined if
plugins are disabled.  Therefore, calls to this method
must be guarded by a check that plugins actually are enabled.

Testplan for koha-testing-docker:

- Edit /etc/koha/sites/kohadev/koha-conf.xml and disable plugins by
  setting <enable_plugins>0</enable_plugins>
- sudo koha-mysql kohadev -e "UPDATE systempreferences SET value='1' WHERE variable='ILLModule';"
- Run restart_all.
- In staff interface, go to About koha -> System information. The page
  should load normally (as opposed to returning 500 internal server
  error).

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5ebffcff28)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Andreas Jonsson 2024-09-09 16:51:10 +00:00 committed by Lucas Gass
parent 264c2ad2f0
commit 4dfd705f9d
1 changed files with 1 additions and 0 deletions

View File

@ -115,6 +115,7 @@ Returns a list of names for all the installed ILL backend plugins.
sub get_backend_plugin_names {
my ( $self ) = @_;
return () unless C4::Context->config("enable_plugins");
my @backend_plugins = Koha::Plugins->new()->GetPlugins(
{
method => 'ill_backend',