From 92b2956d39a21badde1bd042221a954b8c972b88 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 9 Oct 2023 13:04:07 +0100 Subject: [PATCH] Bug 35011: Record interface used to install a plugin This patch adds a record of the interface used when installing a plugin for the first time. We utilise the existing plugin_data table and add a new __INSTALLED_VIA__ system key to store the data. --- Koha/Plugins.pm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm index a3c47006b55..d328a2e67e2 100644 --- a/Koha/Plugins.pm +++ b/Koha/Plugins.pm @@ -270,6 +270,26 @@ sub InstallPlugins { Koha::Cache::Memory::Lite->clear_from_cache(ENABLED_PLUGINS_CACHE_KEY); + my $rs = Koha::Database->schema->resultset('PluginData'); + for my $plugin (@plugins) { + my $exists = $rs->search( + { + plugin_key => '__INSTALLED_VIA__', + plugin_class => $plugin->plugin_class + } + ); + unless ( $exists->count == 1 ) { + $rs->create( + { + plugin_key => '__INSTALLED_VIA__', + plugin_class => $plugin->plugin_class, + plugin_value => C4::Context->interface, + } + ); + + } + } + return @plugins; } -- 2.41.0