Bugzilla – Attachment 142921 Details for
Bug 29672
Increase performance of Koha::Plugins->call
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29672: Clear cache of enabled plugins when a plugin's state change
Bug-29672-Clear-cache-of-enabled-plugins-when-a-pl.patch (text/plain), 2.55 KB, created by
Kyle M Hall (khall)
on 2022-11-02 11:17:35 UTC
(
hide
)
Description:
Bug 29672: Clear cache of enabled plugins when a plugin's state change
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-11-02 11:17:35 UTC
Size:
2.55 KB
patch
obsolete
>From 65cf36f3fb54de47d8b1ddbda274da69e69d78e0 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 6 Jun 2022 09:14:59 +0200 >Subject: [PATCH] Bug 29672: Clear cache of enabled plugins when a plugin's > state change > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Plugins.pm | 10 +++++++--- > Koha/Plugins/Base.pm | 5 +++++ > 2 files changed, 12 insertions(+), 3 deletions(-) > >diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm >index 997d4a48b7..883b6c4f29 100644 >--- a/Koha/Plugins.pm >+++ b/Koha/Plugins.pm >@@ -34,6 +34,8 @@ use Koha::Cache::Memory::Lite; > use Koha::Exceptions::Plugin; > use Koha::Plugins::Methods; > >+use constant ENABLED_PLUGINS_CACHE_KEY => 'enabled_plugins'; >+ > BEGIN { > my $pluginsdir = C4::Context->config("pluginsdir"); > my @pluginsdir = ref($pluginsdir) eq 'ARRAY' ? @$pluginsdir : $pluginsdir; >@@ -103,8 +105,7 @@ sub get_enabled_plugins { > > return unless C4::Context->config('enable_plugins'); > >- my $cache_key = 'enabled_plugins'; >- my $enabled_plugins = Koha::Cache::Memory::Lite->get_from_cache($cache_key); >+ my $enabled_plugins = Koha::Cache::Memory::Lite->get_from_cache(ENABLED_PLUGINS_CACHE_KEY); > unless ($enabled_plugins) { > $enabled_plugins = []; > my $rs = Koha::Database->schema->resultset('PluginData'); >@@ -124,7 +125,7 @@ sub get_enabled_plugins { > > push @$enabled_plugins, $plugin; > } >- Koha::Cache::Memory::Lite->set_in_cache($cache_key, $enabled_plugins); >+ Koha::Cache::Memory::Lite->set_in_cache(ENABLED_PLUGINS_CACHE_KEY, $enabled_plugins); > } > > return @$enabled_plugins; >@@ -258,6 +259,9 @@ sub InstallPlugins { > warn $error unless $error =~ m|^Could not find or check module '$plugin_class'|; > } > } >+ >+ Koha::Cache::Memory::Lite->clear_from_cache(ENABLED_PLUGINS_CACHE_KEY); >+ > return @plugins; > } > >diff --git a/Koha/Plugins/Base.pm b/Koha/Plugins/Base.pm >index 487a3dc5e2..8e547fba0d 100644 >--- a/Koha/Plugins/Base.pm >+++ b/Koha/Plugins/Base.pm >@@ -29,6 +29,7 @@ use C4::Context; > use C4::Output qw( output_with_http_headers ); > > use Koha::Exceptions::Plugin; >+use Koha::Cache::Memory::Lite; > > =head1 NAME > >@@ -104,6 +105,10 @@ sub store_data { > foreach my $key ( keys %$data ) { > $sth->execute( $self->{'class'}, $key, $data->{$key} ); > } >+ >+ if (exists $data->{__ENABLED__}) { >+ Koha::Cache::Memory::Lite->clear_from_cache(Koha::Plugins->ENABLED_PLUGINS_CACHE_KEY); >+ } > } > > =head2 retrieve_data >-- >2.30.2
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 29672
:
128376
|
128377
|
135660
|
135661
|
135704
|
142844
|
142845
|
142846
|
142916
|
142919
|
142920
| 142921 |
142922
|
142923