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.
Created attachment 182856 [details] [review] Bug 40033: Call GetPlugins correctly in background_jobs.pl Test plan: 1. Install a plugin that does not have any background_tasks, e.g. https://github.com/HKS3/HKS3GeoSearch/releases/tag/v0.12 2. Navigate to http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl, observe a 500 3. Apply patch 4. Observe no 500
Created attachment 182886 [details] [review] Bug 40033: Call GetPlugins correctly in background_jobs.pl Test plan: 1. Install a plugin that does not have any background_tasks, e.g. https://github.com/HKS3/HKS3GeoSearch/releases/tag/v0.12 2. Navigate to http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl, observe a 500 3. Apply patch 4. Observe no 500 Signed-off-by: David Nind <david@davidnind.com>
Added assignee, changed to a normal bug (fixes something that is broken/not working as it should), changed the title.
Upgrading to major since it's quite a significant failure.
Created attachment 182894 [details] [review] Bug 40033: Call GetPlugins correctly in background_jobs.pl Test plan: 1. Install a plugin that does not have any background_tasks, e.g. https://github.com/HKS3/HKS3GeoSearch/releases/tag/v0.12 2. Navigate to http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl, observe a 500 3. Apply patch 4. Observe no 500 Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: David Cook <dcook@prosentient.com.au>
Nice work everyone! Pushed to main for 25.11
Not sure who is supposed to add "rel_25_05_candidate" here. I'm adding it here, but someone let me know if that's wrong... Note this only needs to be backported to 25.05 (unless 39772 gets backported too I guess...)
I see in 25.05.x
Bug 39772 backported plus this one Pushed to 24.11.x for 24.11.06
Nice work everyone! Pushed to 25.05.x for 25.05.03
Merge conflicts with 24.05.x
Oops, it looks like this caused another bug. Error 500 if you have plugins disabled. But fix is on bug 40547.
(In reply to Jesse Maseto from comment #11) > Merge conflicts with 24.05.x Hi Jesse, The patch on this bug report applies cleanly for me on the upstream 24.05.x branch right now: -- kohadev-koha@kohadevbox:koha(24.05.x)$ git bz apply 40033 Bug 40033 - The background jobs page calls GetPlugins incorrectly, resulting in a 500 error 182894 - Bug 40033: Call GetPlugins correctly in background_jobs.pl Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 40033: Call GetPlugins correctly in background_jobs.pl Auto packing the repository in background for optimum performance. See "git help gc" for manual housekeeping. kohadev-koha@kohadevbox:koha(24.05.x)$ --- Would you mind please trying to backport it again to 24.05.x?