Bugzilla – Attachment 89786 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: (follow-up) Rebase from master
Bug-21073-follow-up-Rebase-from-master.patch (text/plain), 4.53 KB, created by
Agustín Moyano
on 2019-05-15 15:49:09 UTC
(
hide
)
Description:
Bug 21073: (follow-up) Rebase from master
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2019-05-15 15:49:09 UTC
Size:
4.53 KB
patch
obsolete
>From a5266a2273610a6959c815f2ce440a900eae6d6b Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Wed, 15 May 2019 12:05:36 -0300 >Subject: [PATCH] Bug 21073: (follow-up) Rebase from master > >--- > Koha/Plugins.pm | 16 +++++++-------- > t/db_dependent/Plugins.t | 52 +++++++++++++++++++++++++----------------------- > 2 files changed, 35 insertions(+), 33 deletions(-) > >diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm >index 14dfb8fbc4..44e2a521a4 100644 >--- a/Koha/Plugins.pm >+++ b/Koha/Plugins.pm >@@ -87,17 +87,17 @@ sub GetPlugins { > > load $plugin_class; > my $plugin = $plugin_class->new({ enable_plugins => $self->{'enable_plugins'} }); >- >- my $plugin_enabled = $plugin->retrieve_data('__ENABLED__'); >- $plugin->{enabled} = $plugin_enabled; > >+ my $plugin_enabled = $plugin->retrieve_data('__ENABLED__'); >+ $plugin->{enabled} = $plugin_enabled; > >- # Want all plugins. Not only enabled ones. >- if ( defined($params->{all}) && $params->{all} ) { >- $plugin_enabled = 1; >- } > >- next unless $plugin_enabled; >+ # Want all plugins. Not only enabled ones. >+ if ( defined($params->{all}) && $params->{all} ) { >+ $plugin_enabled = 1; >+ } >+ >+ next unless $plugin_enabled; > > # filter the plugin out by metadata > my $plugin_metadata = $plugin->get_metadata; >diff --git a/t/db_dependent/Plugins.t b/t/db_dependent/Plugins.t >index 70e7fb3e7a..5795f86145 100755 >--- a/t/db_dependent/Plugins.t >+++ b/t/db_dependent/Plugins.t >@@ -23,7 +23,7 @@ use File::Temp qw( tempdir tempfile ); > use FindBin qw($Bin); > use Module::Load::Conditional qw(can_load); > use Test::MockModule; >-use Test::More tests => 47; >+use Test::More tests => 49; > > use C4::Context; > use Koha::Database; >@@ -55,12 +55,12 @@ subtest 'GetPlugins() tests' => sub { > my $plugins = Koha::Plugins->new({ enable_plugins => 1 }); > $plugins->InstallPlugins; > >- my @plugins = $plugins->GetPlugins({ method => 'report' }); >+ my @plugins = $plugins->GetPlugins({ method => 'report', all => 1 }); > > my @names = map { $_->get_metadata()->{'name'} } @plugins; > is( scalar grep( /^Test Plugin$/, @names), 1, "Koha::Plugins::GetPlugins functions correctly" ); > >- @plugins = $plugins->GetPlugins({ metadata => { my_example_tag => 'find_me' } }); >+ @plugins = $plugins->GetPlugins({ metadata => { my_example_tag => 'find_me' }, all => 1 }); > @names = map { $_->get_metadata()->{'name'} } @plugins; > is( scalar @names, 2, "Only two plugins found via a metadata tag" ); > >@@ -88,6 +88,28 @@ subtest 'Version upgrade tests' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'Version upgrade tests' => sub { >+ >+ plan tests => 1; >+ >+ $schema->storage->txn_begin; >+ >+ my $plugin = Koha::Plugin::Test->new( { enable_plugins => 1, cgi => CGI->new } ); >+ >+ # make sure there's no version on the DB >+ $schema->resultset('PluginData') >+ ->search( { plugin_class => $plugin->{class}, plugin_key => '__INSTALLED_VERSION__' } ) >+ ->delete; >+ >+ $plugin = Koha::Plugin::Test->new( { enable_plugins => 1, cgi => CGI->new } ); >+ my $version = $plugin->retrieve_data('__INSTALLED_VERSION__'); >+ >+ is( $version, $plugin->get_metadata->{version}, 'Version has been populated correctly' ); >+ >+ $schema->storage->txn_rollback; >+}; >+ >+ > $schema->storage->txn_begin; > Koha::Plugins::Methods->delete; > >@@ -239,28 +261,6 @@ subtest 'output and output_html tests' => sub { > like($stdout, qr{¡Hola output_html!}, 'Correct data'); > }; > >-subtest 'Version upgrade tests' => sub { >- >- plan tests => 1; >- >- $schema->storage->txn_begin; >- >- my $plugin = Koha::Plugin::Test->new( { enable_plugins => 1, cgi => CGI->new } ); >- >- # make sure there's no version on the DB >- $schema->resultset('PluginData') >- ->search( { plugin_class => $plugin->{class}, plugin_key => '__INSTALLED_VERSION__' } ) >- ->delete; >- >- $plugin = Koha::Plugin::Test->new( { enable_plugins => 1, cgi => CGI->new } ); >- my $version = $plugin->retrieve_data('__INSTALLED_VERSION__'); >- >- is( $version, $plugin->get_metadata->{version}, 'Version has been populated correctly' ); >- >- $schema->storage->txn_rollback; >-}; >- >- > subtest 'Test _version_compare' => sub { > > plan tests => 6; >@@ -286,3 +286,5 @@ subtest 'new() tests' => sub { > $result = Koha::Plugins->new({ enable_plugins => 1 }); > is( ref($result), 'Koha::Plugins', 'calling new with enable_plugins makes it override the config' ); > }; >+ >+$schema->storage->txn_rollback; >\ No newline at end of file >-- >2.11.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