[Bug 40033] New: admin/background_jobs.pl calls GetPlugins incorrectly
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: koha-bugs@lists.koha-community.org Reporter: tadeusz@sosnierz.com QA Contact: testopia@bugs.koha-community.org 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.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 --- Comment #1 from HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> --- Created attachment 182856 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=182856&action=edit 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 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #182856|0 |1 is obsolete| | --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 182886 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=182886&action=edit 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> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This fixes the background release notes| |jobs page (Koha | |administration > Jobs > | |Manage jobs) so that it | |doesn't generate a 500 | |error when a plugin does | |not have a background task | |(it currently calls | |GetPlugins incorrectly). CC| |david@davidnind.com Severity|enhancement |normal Summary|admin/background_jobs.pl |The background jobs page |calls GetPlugins |calls GetPlugins |incorrectly |incorrectly, resulting in a | |500 error Assignee|koha-bugs@lists.koha-commun |tadeusz@sosnierz.com |ity.org | --- Comment #3 from 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. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au QA Contact|testopia@bugs.koha-communit |dcook@prosentient.com.au |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |major --- Comment #4 from David Cook <dcook@prosentient.com.au> --- Upgrading to major since it's quite a significant failure. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #182886|0 |1 is obsolete| | --- Comment #5 from David Cook <dcook@prosentient.com.au> --- Created attachment 182894 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=182894&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |39772 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39772 [Bug 39772] Background jobs page lists unknown job types for jobs implemented by plugins -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |25.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 --- Comment #6 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 25.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_25_05_candidate --- Comment #7 from David Cook <dcook@prosentient.com.au> --- 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...) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Pushed to stable CC| |fridolin.somers@biblibre.co | |m Version(s)|25.11.00 |25.11.00,25.05.01 released in| | --- Comment #8 from Fridolin Somers <fridolin.somers@biblibre.com> --- I see in 25.05.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Pushed to oldstable Version(s)|25.11.00,25.05.01 |25.11.00,25.05.01,24.11.06 released in| | --- Comment #9 from Fridolin Somers <fridolin.somers@biblibre.com> --- Bug 39772 backported plus this one Pushed to 24.11.x for 24.11.06 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 --- Comment #10 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Nice work everyone! Pushed to 25.05.x for 25.05.03 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 Jesse Maseto <jesse@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jesse@bywatersolutions.com --- Comment #11 from Jesse Maseto <jesse@bywatersolutions.com> --- Merge conflicts with 24.05.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |40547 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40547 [Bug 40547] Unable to view background job if enable_plugins is 0 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 --- Comment #12 from David Cook <dcook@prosentient.com.au> --- Oops, it looks like this caused another bug. Error 500 if you have plugins disabled. But fix is on bug 40547. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 Alex Buckley <alexbuckley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |alexbuckley@catalyst.net.nz --- Comment #13 from Alex Buckley <alexbuckley@catalyst.net.nz> --- (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? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rel_25_05_candidate | CC| |paul.derscheid@lmscloud.de -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 Bug 40033 depends on bug 39772, which changed state. Bug 39772 Summary: Background jobs page lists unknown job types for jobs implemented by plugins https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39772 What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |Needs documenting CC| |wainuiwitikapark@catalyst.n | |et.nz --- Comment #14 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Not backporting to 22.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40033 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED --- Comment #15 from David Nind <david@davidnind.com> --- Architecture change/bug fix, no changes required to the manual. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org