Bugzilla – Attachment 90657 Details for
Bug 21073
Improve plugin performance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21073: Restore filtering by metadata
Bug-21073-Restore-filtering-by-metadata.patch (text/plain), 2.39 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-06-17 11:21:41 UTC
(
hide
)
Description:
Bug 21073: Restore filtering by metadata
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-06-17 11:21:41 UTC
Size:
2.39 KB
patch
obsolete
>From da80c1b889193b1d06920314ae6fe57b2769fcf2 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 2 May 2019 13:15:49 -0300 >Subject: [PATCH] Bug 21073: Restore filtering by metadata > >This patch restores filtering the plugins by metadata. That got lost on >rebase at some point. Regression tests are added on a prior patch. > >To test: >- Have the 'regression tests for GetPlugins' patch applied >- Run: > $ kshell > k$ prove t/db_dependent/Plugins.t >=> FAIL: Tests fail! >- Apply this patch >- Run: > k$ prove t/db_dependent/Plugins.t >=> SUCCESS: Tests pass! >- Sign off :-D > >Signed-off-by: Agustin Moyano <agustinmoyano@theke.io> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Plugins.pm | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > >diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm >index 9d6d827a45..301ae65201 100644 >--- a/Koha/Plugins.pm >+++ b/Koha/Plugins.pm >@@ -20,6 +20,7 @@ package Koha::Plugins; > use Modern::Perl; > > use Class::Inspector; >+use List::MoreUtils qw(any); > use Module::Load::Conditional qw(can_load); > use Module::Load qw(load); > use Module::Pluggable search_path => ['Koha::Plugin'], except => qr/::Edifact(|::Line|::Message|::Order|::Segment|::Transport)$/; >@@ -76,8 +77,14 @@ sub GetPlugins { > my $plugin_classes = $dbh->selectcol_arrayref('SELECT DISTINCT(plugin_class) FROM plugin_methods'); > my @plugins; > >+ # Loop through all plugins that implement at least a method > foreach my $plugin_class (@$plugin_classes) { >- next if $method && !Koha::Plugins::Methods->search({ plugin_class => $plugin_class, plugin_method => $method })->count; >+ # filter the plugin out by method >+ next >+ if $method >+ && !Koha::Plugins::Methods->search( >+ { plugin_class => $plugin_class, plugin_method => $method } )->count; >+ > load $plugin_class; > my $plugin = $plugin_class->new({ enable_plugins => $self->{'enable_plugins'} }); > >@@ -91,8 +98,17 @@ sub GetPlugins { > > next unless $plugin_enabled; > >+ # filter the plugin out by metadata >+ my $plugin_metadata = $plugin->get_metadata; >+ next >+ if $plugin_metadata >+ and %$req_metadata >+ and any { !$plugin_metadata->{$_} || $plugin_metadata->{$_} ne $req_metadata->{$_} } keys %$req_metadata; >+ > push @plugins, $plugin; >+ > } >+ > return @plugins; > } > >-- >2.22.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21073
:
76955
|
76956
|
76957
|
76958
|
76973
|
88379
|
88380
|
88381
|
89247
|
89251
|
89252
|
89255
|
89256
|
89272
|
89273
|
89274
|
89275
|
89276
|
89277
|
89278
|
89279
|
89786
|
89800
|
89801
|
89802
|
89803
|
89804
|
89805
|
89806
|
89807
|
89808
|
90630
|
90631
|
90650
|
90651
|
90652
|
90653
|
90654
|
90655
|
90656
|
90657
|
90658
|
90659
|
90660
|
90661
|
90662
|
90663
|
90664
|
90724
|
90725
|
90726
|
90727
|
90728
|
90729
|
90730
|
90731
|
90732
|
90733
|
90734
|
90735
|
90736
|
90737
|
90738
|
90739
|
90759
|
90816