Bugzilla – Attachment 53718 Details for
Bug 16586
Koha Plugins: Limit results of GetPlugins by metadata
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16586: Simplify code using none
Bug-16586-Simplify-code-using-none.patch (text/plain), 1.73 KB, created by
Marcel de Rooy
on 2016-07-26 12:04:27 UTC
(
hide
)
Description:
Bug 16586: Simplify code using none
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-07-26 12:04:27 UTC
Size:
1.73 KB
patch
obsolete
>From 21b16283fb365973cf13b7b4baf71a0bcec0b176 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 25 Jul 2016 16:10:34 +0100 >Subject: [PATCH] Bug 16586: Simplify code using none >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/Plugins.pm | 14 +++++--------- > 1 file changed, 5 insertions(+), 9 deletions(-) > >diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm >index d3eddcf..dcfd32f 100644 >--- a/Koha/Plugins.pm >+++ b/Koha/Plugins.pm >@@ -21,6 +21,7 @@ use Modern::Perl; > > use Module::Load::Conditional qw(can_load); > use Module::Pluggable search_path => ['Koha::Plugin'], except => qr/::Edifact(|::Line|::Message|::Order|::Segment|::Transport)$/; >+use List::MoreUtils qw( none ); > > use C4::Context; > use C4::Output; >@@ -76,17 +77,12 @@ sub GetPlugins { > my $plugin = $plugin_class->new({ enable_plugins => $self->{'enable_plugins'} }); > > # Limit results by method or metadata >- my $ok = 1; > next if $method && !$plugin->can($method); > my $plugin_metadata = $plugin->get_metadata; >- foreach my $key ( keys %$req_metadata ) { >- if( !$plugin_metadata->{$key} || >- $plugin_metadata->{$key} ne $req_metadata->{$key} ) { >- $ok = 0; >- last; >- } >- } >- push( @plugins, $plugin ) if $ok; >+ next if $plugin_metadata >+ and %$req_metadata >+ and none { exists $plugin_metadata->{$_} and $plugin_metadata->{$_} eq $req_metadata->{$_} } keys %$req_metadata; >+ push @plugins, $plugin; > } > } > return @plugins; >-- >1.7.10.4
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 16586
:
51771
|
53544
|
53691
|
53692
|
53717
|
53718
|
53747
|
53748