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

(-)a/Koha/Plugins.pm (-3 / +16 lines)
Lines 187-195 method or metadata value. Link Here
187
The method and metadata parameters are optional.
187
The method and metadata parameters are optional.
188
If you pass multiple keys in the metadata hash, all keys must match.
188
If you pass multiple keys in the metadata hash, all keys must match.
189
189
190
If you pass errors (only used in plugins-home), we return two arrayrefs:
190
If called in scalar context, a different data structure is returned:
191
191
192
    ( $good, $bad ) = Koha::Plugins::GetPlugins( { errors => 1 } );
192
    my $plugins = Koha::Plugins::GetPlugins({
193
        method => 'some_method',
194
        metadata => { some_key => 'some_value' },
195
        [ all => 1, errors => 1, verbose => 1 ],
196
    });
197
198
where I<$plugins> looks like:
199
200
    {
201
        good => [ plugin_1, ... ],
202
        bad  => [ { error => 1, name => 'PluginClass1 }, ... ]
203
    }
204
205
The B<bad> part of the response will only get returned If you pass I<errors>.
193
206
194
If you pass verbose, you can enable or disable explicitly warnings
207
If you pass verbose, you can enable or disable explicitly warnings
195
from Module::Load::Conditional. Disabled by default to not flood
208
from Module::Load::Conditional. Disabled by default to not flood
Lines 255-261 sub GetPlugins { Link Here
255
        }
268
        }
256
    }
269
    }
257
270
258
    return $errors ? ( \@plugins, \@failing ) : @plugins;
271
    return wantarray ? @plugins : { good => \@plugins, bad => \@failing };
259
}
272
}
260
273
261
=head2 InstallPlugins
274
=head2 InstallPlugins
(-)a/plugins/plugins-home.pl (-3 / +2 lines)
Lines 50-56 if ($plugins_enabled) { Link Here
50
        method       => $method,
50
        method       => $method,
51
    );
51
    );
52
52
53
    my ( $plugins, $failures ) = Koha::Plugins->new()->GetPlugins(
53
    my $plugins = Koha::Plugins->new()->GetPlugins(
54
        {
54
        {
55
            method => $method,
55
            method => $method,
56
            all    => 1,
56
            all    => 1,
Lines 58-64 if ($plugins_enabled) { Link Here
58
        }
58
        }
59
    );
59
    );
60
60
61
    $template->param( plugins            => [ @$plugins, @$failures ] );
61
    $template->param( plugins            => [ @{$plugins->{good}}, @{$plugins->{bad}} ] );
62
    $template->param( plugins_restricted => C4::Context->config('plugins_restricted') );
62
    $template->param( plugins_restricted => C4::Context->config('plugins_restricted') );
63
63
64
    $template->param( can_search => C4::Context->config('plugin_repos') ? 1 : 0 );
64
    $template->param( can_search => C4::Context->config('plugin_repos') ? 1 : 0 );
65
- 

Return to bug 36419