Bug 10403: (follow-up) fix test to use vendor created earlier during test
[koha.git] / Koha / Plugins.pm
index 797f600..3b31fc5 100644 (file)
@@ -26,8 +26,6 @@ use C4::Context;
 use C4::Output;
 
 BEGIN {
-    die('Plugins not enabled in config') unless ( C4::Context->config("enable_plugins") );
-
     push @INC, C4::Context->config("pluginsdir");
 }
 
@@ -40,6 +38,8 @@ Koha::Plugins - Module for loading and managing plugins.
 sub new {
     my ( $class, $args ) = @_;
 
+    return unless ( C4::Context->config("enable_plugins") || $args->{'enable_plugins'} );
+
     $args->{'pluginsdir'} = C4::Context->config("pluginsdir");
 
     return bless( $args, $class );
@@ -63,7 +63,7 @@ sub GetPlugins {
 
     foreach my $plugin_class (@plugin_classes) {
         if ( can_load( modules => { $plugin_class => undef } ) ) {
-            my $plugin = $plugin_class->new();
+            my $plugin = $plugin_class->new({ enable_plugins => $self->{'enable_plugins'} });
 
             if ($method) {
                 if ( $plugin->can($method) ) {