|
Lines 60-71
if plugins are not available or none are enabled.
Link Here
|
| 60 |
=cut |
60 |
=cut |
| 61 |
|
61 |
|
| 62 |
sub get_enabled_plugins { |
62 |
sub get_enabled_plugins { |
| 63 |
my ($class) = @_; |
63 |
my ( $class, $params ) = @_; |
| 64 |
|
64 |
|
| 65 |
my $cache_key = 'enabled_plugins'; |
65 |
my $cache_key = 'enabled_plugins'; |
| 66 |
my $cached = Koha::Cache::Memory::Lite->get_from_cache($cache_key); |
66 |
my $cached = Koha::Cache::Memory::Lite->get_from_cache($cache_key); |
| 67 |
return @$cached if $cached; |
67 |
return @$cached if $cached; |
| 68 |
|
68 |
|
|
|
69 |
my $verbose = $params->{verbose} // 0; |
| 70 |
|
| 69 |
# Check if plugin_data table exists (using DBH for early init safety) |
71 |
# Check if plugin_data table exists (using DBH for early init safety) |
| 70 |
my $dbh = eval { Koha::Database->dbh }; |
72 |
my $dbh = eval { Koha::Database->dbh }; |
| 71 |
return unless $dbh; |
73 |
return unless $dbh; |
|
Lines 101-112
sub get_enabled_plugins {
Link Here
|
| 101 |
if ( eval { Koha::Plugins->can('can_load') } ) { |
103 |
if ( eval { Koha::Plugins->can('can_load') } ) { |
| 102 |
|
104 |
|
| 103 |
# Use Koha::Plugins::can_load if it exists (might be mocked in tests) |
105 |
# Use Koha::Plugins::can_load if it exists (might be mocked in tests) |
| 104 |
$can_load_result = eval { Koha::Plugins::can_load( modules => { $plugin_class => undef }, nocache => 1 ) }; |
106 |
$can_load_result = eval { |
|
|
107 |
Koha::Plugins::can_load( modules => { $plugin_class => undef }, verbose => $verbose, nocache => 1 ); |
| 108 |
}; |
| 105 |
} |
109 |
} |
| 106 |
if ( !defined $can_load_result ) { |
110 |
if ( !defined $can_load_result ) { |
| 107 |
|
111 |
|
| 108 |
# Fall back to Module::Load::Conditional |
112 |
# Fall back to Module::Load::Conditional |
| 109 |
$can_load_result = can_load( modules => { $plugin_class => undef }, nocache => 1 ); |
113 |
$can_load_result = can_load( modules => { $plugin_class => undef }, verbose => $verbose, nocache => 1 ); |
| 110 |
} |
114 |
} |
| 111 |
|
115 |
|
| 112 |
next unless $can_load_result; |
116 |
next unless $can_load_result; |
| 113 |
- |
|
|