View | Details | Raw Unified | Return to bug 29672
Collapse All | Expand All

(-)a/Koha/Plugins.pm (-3 / +7 lines)
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
(-)a/Koha/Plugins/Base.pm (-1 / +5 lines)
Lines 29-34 use C4::Context; Link Here
29
use C4::Output qw( output_with_http_headers );
29
use C4::Output qw( output_with_http_headers );
30
30
31
use Koha::Exceptions::Plugin;
31
use Koha::Exceptions::Plugin;
32
use Koha::Cache::Memory::Lite;
32
33
33
=head1 NAME
34
=head1 NAME
34
35
Lines 104-109 sub store_data { Link Here
104
    foreach my $key ( keys %$data ) {
105
    foreach my $key ( keys %$data ) {
105
        $sth->execute( $self->{'class'}, $key, $data->{$key} );
106
        $sth->execute( $self->{'class'}, $key, $data->{$key} );
106
    }
107
    }
108
109
    if (exists $data->{__ENABLED__}) {
110
        Koha::Cache::Memory::Lite->clear_from_cache(Koha::Plugins->ENABLED_PLUGINS_CACHE_KEY);
111
    }
107
}
112
}
108
113
109
=head2 retrieve_data
114
=head2 retrieve_data
110
- 

Return to bug 29672