Bug 20496 - Consolidate the checks to see if plugins are enabled in Koha::Plugin::new
Summary: Consolidate the checks to see if plugins are enabled in Koha::Plugin::new
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 20181
Blocks:
  Show dependency treegraph
 
Reported: 2018-03-29 14:56 UTC by Kyle M Hall
Modified: 2018-03-29 15:18 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall 2018-03-29 14:56:12 UTC
The separate checks to see if plugins are enabled are placed separately throughout the Koha codebase. We should consolidate all those checks within Koha::Plugins.
Comment 1 Kyle M Hall 2018-03-29 15:00:48 UTC
Point of note, we check two different things:
1) Is UseKohaPlugins enabled
2) Is enabled_plugins set in the Koha config file

I think we should have a method in Koha::Plugins that checks both and returns true/false. If there are any parts of Koha that only check one for a good reason, we can have another method to check just that.
Comment 2 Mark Tompsett 2018-03-29 15:18:18 UTC
(In reply to Kyle M Hall from comment #1)
> Point of note, we check two different things:
> 1) Is UseKohaPlugins enabled
> 2) Is enabled_plugins set in the Koha config file
> 
> I think we should have a method in Koha::Plugins that checks both and
> returns true/false. If there are any parts of Koha that only check one for a
> good reason, we can have another method to check just that.

Or you could return a hashref.
Configured => true/false                    # true when both syspref and config
Failures => [systempreference,config,other] # an array with what fails

Then:
my $rv = Koha::Plugins->configured();
if ( $rv->{Configured} ) { ... }
or perhaps
if ( $rv->{Configured} || ! grep { $_ eq 'systempreference' } @{$rv->Failures} ) {
 ...
}