https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033

            Bug ID: 40033
           Summary: admin/background_jobs.pl calls GetPlugins incorrectly
 Change sponsored?: ---
           Product: Koha
           Version: Main
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]

In the aforementioned script, GetPlugins is used as so:

```
my @plugins = Koha::Plugins::GetPlugins(
    {
        method => 'background_tasks',
    }
);
my @plugin_job_types;
for my $plugin (@plugins) {
    my $tasks = $plugin->background_tasks;

```

This currently results in a 500 when it tries to call background_tasks on a
plugin that doesn't have it. The reason for this is an incorrect method call to
GetPlugins – since there is no invocant, the $params get intepreted as $self
(with $params ending up undefined), and so the method filtering doesn't work –
which is why we end up calling background_tasks on plugins we did not want to.

In the rest of Koha it's universally used as
`Koha::Plugins->new()->GetPlugins()`, so it makes sense to follow that trend
here. At the same time, I wonder if a more strict linting rules (or a safer
API) could've prevented it from happening in the first place.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to