|
Lines 34-39
use Koha::Cache::Memory::Lite;
Link Here
|
| 34 |
use Koha::Exceptions::Plugin; |
34 |
use Koha::Exceptions::Plugin; |
| 35 |
use Koha::Plugins::Methods; |
35 |
use Koha::Plugins::Methods; |
| 36 |
|
36 |
|
|
|
37 |
use constant ENABLED_PLUGINS_CACHE_KEY => 'enabled_plugins'; |
| 38 |
|
| 37 |
BEGIN { |
39 |
BEGIN { |
| 38 |
my $pluginsdir = C4::Context->config("pluginsdir"); |
40 |
my $pluginsdir = C4::Context->config("pluginsdir"); |
| 39 |
my @pluginsdir = ref($pluginsdir) eq 'ARRAY' ? @$pluginsdir : $pluginsdir; |
41 |
my @pluginsdir = ref($pluginsdir) eq 'ARRAY' ? @$pluginsdir : $pluginsdir; |
|
Lines 103-110
sub get_enabled_plugins {
Link Here
|
| 103 |
|
105 |
|
| 104 |
return unless C4::Context->config('enable_plugins'); |
106 |
return unless C4::Context->config('enable_plugins'); |
| 105 |
|
107 |
|
| 106 |
my $cache_key = 'enabled_plugins'; |
108 |
my $enabled_plugins = Koha::Cache::Memory::Lite->get_from_cache(ENABLED_PLUGINS_CACHE_KEY); |
| 107 |
my $enabled_plugins = Koha::Cache::Memory::Lite->get_from_cache($cache_key); |
|
|
| 108 |
unless ($enabled_plugins) { |
109 |
unless ($enabled_plugins) { |
| 109 |
$enabled_plugins = []; |
110 |
$enabled_plugins = []; |
| 110 |
my $rs = Koha::Database->schema->resultset('PluginData'); |
111 |
my $rs = Koha::Database->schema->resultset('PluginData'); |
|
Lines 124-130
sub get_enabled_plugins {
Link Here
|
| 124 |
|
125 |
|
| 125 |
push @$enabled_plugins, $plugin; |
126 |
push @$enabled_plugins, $plugin; |
| 126 |
} |
127 |
} |
| 127 |
Koha::Cache::Memory::Lite->set_in_cache($cache_key, $enabled_plugins); |
128 |
Koha::Cache::Memory::Lite->set_in_cache(ENABLED_PLUGINS_CACHE_KEY, $enabled_plugins); |
| 128 |
} |
129 |
} |
| 129 |
|
130 |
|
| 130 |
return @$enabled_plugins; |
131 |
return @$enabled_plugins; |
|
Lines 258-263
sub InstallPlugins {
Link Here
|
| 258 |
warn $error unless $error =~ m|^Could not find or check module '$plugin_class'|; |
259 |
warn $error unless $error =~ m|^Could not find or check module '$plugin_class'|; |
| 259 |
} |
260 |
} |
| 260 |
} |
261 |
} |
|
|
262 |
|
| 263 |
Koha::Cache::Memory::Lite->clear_from_cache(ENABLED_PLUGINS_CACHE_KEY); |
| 264 |
|
| 261 |
return @plugins; |
265 |
return @plugins; |
| 262 |
} |
266 |
} |
| 263 |
|
267 |
|