From 75f3cb5680693cfca0a0d9e57f52bfcc57ed7481 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 15 Apr 2020 11:48:23 -0300 Subject: [PATCH] Bug 25131: (QA follow-up) Move test for needs_install outside the plugin This follow-up patch moves the check outside the register routine. The Mojo plugin won't be loaded unless there's no need to install. As the original tests rely on V1.pm to be able to load the plugin, they are still valid, and they should still pass as there's no behaviour change. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- Koha/REST/Plugin/PluginRoutes.pm | 3 +-- Koha/REST/V1.pm | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Koha/REST/Plugin/PluginRoutes.pm b/Koha/REST/Plugin/PluginRoutes.pm index 67ff2ae1cf..a90eb81133 100644 --- a/Koha/REST/Plugin/PluginRoutes.pm +++ b/Koha/REST/Plugin/PluginRoutes.pm @@ -45,8 +45,7 @@ sub register { my @plugins; - if ( C4::Context->config("enable_plugins") and - ! C4::Context->needs_install ) # Koha is installed + if ( C4::Context->config("enable_plugins") ) { # plugin needs to define a namespace @plugins = Koha::Plugins->new()->GetPlugins( diff --git a/Koha/REST/V1.pm b/Koha/REST/V1.pm index 0b14b97b95..894457b0c8 100644 --- a/Koha/REST/V1.pm +++ b/Koha/REST/V1.pm @@ -86,7 +86,7 @@ sub startup { spec => $spec, validator => undef } - ); + ) unless C4::Context->needs_install; # load only if Koha is installed $self->plugin( OpenAPI => { @@ -115,7 +115,7 @@ sub startup { spec => $spec, validator => $validator } - ); + ) unless C4::Context->needs_install; # load only if Koha is installed $self->plugin( OpenAPI => { -- 2.39.5