View | Details | Raw Unified | Return to bug 9907
Collapse All | Expand All

(-)a/Koha/Plugins.pm (-1 / +1 lines)
Lines 63-69 sub GetPlugins { Link Here
63
63
64
    foreach my $plugin_class (@plugin_classes) {
64
    foreach my $plugin_class (@plugin_classes) {
65
        if ( can_load( modules => { $plugin_class => undef } ) ) {
65
        if ( can_load( modules => { $plugin_class => undef } ) ) {
66
            my $plugin = $plugin_class->new();
66
            my $plugin = $plugin_class->new({ enable_plugins => $self->{'enable_plugins'} });
67
67
68
            if ($method) {
68
            if ($method) {
69
                if ( $plugin->can($method) ) {
69
                if ( $plugin->can($method) ) {
(-)a/Koha/Plugins/Handler.pm (-1 / +1 lines)
Lines 58-64 sub run { Link Here
58
    my $cgi           = $args->{'cgi'};
58
    my $cgi           = $args->{'cgi'};
59
59
60
    if ( can_load( modules => { $plugin_class => undef } ) ) {
60
    if ( can_load( modules => { $plugin_class => undef } ) ) {
61
        my $plugin = $plugin_class->new( { cgi => $cgi } );
61
        my $plugin = $plugin_class->new( { cgi => $cgi, enable_plugins => $args->{'enable_plugins'} } );
62
        if ( $plugin->can($plugin_method) ) {
62
        if ( $plugin->can($plugin_method) ) {
63
            return $plugin->$plugin_method();
63
            return $plugin->$plugin_method();
64
        } else {
64
        } else {
(-)a/t/db_dependent/Plugins.t (-3 / +2 lines)
Lines 33-39 ok( $plugin->can('configure'), 'Test plugin can configure' ); Link Here
33
ok( $plugin->can('install'), 'Test plugin can install' );
33
ok( $plugin->can('install'), 'Test plugin can install' );
34
ok( $plugin->can('uninstall'), 'Test plugin can install' );
34
ok( $plugin->can('uninstall'), 'Test plugin can install' );
35
35
36
ok( Koha::Plugins::Handler->run({ class => "Koha::Plugin::Test", method => 'report' }) eq "Koha::Plugin::Test::report", 'Test run plugin report method' );
36
ok( Koha::Plugins::Handler->run({ class => "Koha::Plugin::Test", method => 'report', enable_plugins => 1 }) eq "Koha::Plugin::Test::report", 'Test run plugin report method' );
37
37
38
my $metadata = $plugin->get_metadata();
38
my $metadata = $plugin->get_metadata();
39
ok( $metadata->{'name'} eq 'Test Plugin', 'Test $plugin->get_metadata()' );
39
ok( $metadata->{'name'} eq 'Test Plugin', 'Test $plugin->get_metadata()' );
Lines 41-47 ok( $metadata->{'name'} eq 'Test Plugin', 'Test $plugin->get_metadata()' ); Link Here
41
ok( $plugin->get_qualified_table_name('mytable') eq 'koha_plugin_test_mytable', 'Test $plugin->get_qualified_table_name()' );
41
ok( $plugin->get_qualified_table_name('mytable') eq 'koha_plugin_test_mytable', 'Test $plugin->get_qualified_table_name()' );
42
ok( $plugin->get_plugin_http_path() eq '/plugin/Koha/Plugin/Test', 'Test $plugin->get_plugin_http_path()' );
42
ok( $plugin->get_plugin_http_path() eq '/plugin/Koha/Plugin/Test', 'Test $plugin->get_plugin_http_path()' );
43
43
44
my @plugins = Koha::Plugins->new()->GetPlugins( 'report' );
44
my @plugins = Koha::Plugins->new({ enable_plugins => 1 })->GetPlugins( 'report' );
45
ok( $plugins[0]->get_metadata()->{'name'} eq 'Test Plugin', "Koha::Plugins::GetPlugins functions correctly" );
45
ok( $plugins[0]->get_metadata()->{'name'} eq 'Test Plugin', "Koha::Plugins::GetPlugins functions correctly" );
46
46
47
my $plugins_dir = C4::Context->config("pluginsdir");
47
my $plugins_dir = C4::Context->config("pluginsdir");
48
- 

Return to bug 9907