From abe2bc6e9403e88eba47b5e8ddbe53e9943b2c5c Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 22 Apr 2020 12:46:35 -0400 Subject: [PATCH] Bug 25222: (QA follow-up) Update @INC when calling Koha::Plugins::new --- Koha/Plugins.pm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm index 52d0e70d64..a64ac1abac 100644 --- a/Koha/Plugins.pm +++ b/Koha/Plugins.pm @@ -30,7 +30,15 @@ use C4::Context; use C4::Output; use Koha::Plugins::Methods; -BEGIN { +=head1 NAME + +Koha::Plugins - Module for loading and managing plugins. + +=cut + +sub new { + my ( $class, $args ) = @_; + my $pluginsdir = C4::Context->config("pluginsdir"); my @pluginsdir = ref($pluginsdir) eq 'ARRAY' ? @$pluginsdir : $pluginsdir; foreach my $dir ( @pluginsdir ) { @@ -39,19 +47,11 @@ BEGIN { ->directory ->in($dir); - push( @INC, @dirs ); + foreach my $d ( @dirs ) { + push( @INC, @dirs ) unless any { $_ eq $d } @INC; + } } pop @INC if $INC[-1] eq '.'; -} - -=head1 NAME - -Koha::Plugins - Module for loading and managing plugins. - -=cut - -sub new { - my ( $class, $args ) = @_; return unless ( C4::Context->config("enable_plugins") || $args->{'enable_plugins'} ); -- 2.24.2 (Apple Git-127)