Bug 40547: Background jobs should appear even when plugins disabled

This change fixes the background jobs so that the list page loads
even when plugins are disabled.

Test plan:
0. Apply the patch
1. Download https://github.com/HKS3/koha-normalize-marc2db/releases/download/v0.91/Koha.Plugin.HKS3.NormalizeMARC2DB-0.91.kpz
2. Upload plugin into KTD
3. Click "Run tool" for plugin
4. Go to http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl
5. Note that you see a pretty "Type"
6. Go to /etc/koha/sites/kohadev/koha-conf.xml and turn enable_plugins to 0
7. sudo koha-plack --restart kohadev
8. Go to http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl
9. Note it now says "Unknown job type 'plugin_marc2db_normalizeall'
10. Celebrate as this is preferable to a 500 error

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
David Cook 2025-07-30 06:41:25 +00:00 committed by Lucas Gass
parent ffd7a4ec10
commit 6e3d0b1e48
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 9 additions and 5 deletions

View File

@ -79,11 +79,15 @@ $template->param(
op => $op,
);
my @plugins = Koha::Plugins->new()->GetPlugins(
{
method => 'background_tasks',
}
);
my @plugins = ();
my $plugin_manager = Koha::Plugins->new();
if ($plugin_manager) {
@plugins = $plugin_manager->GetPlugins(
{
method => 'background_tasks',
}
);
}
my @plugin_job_types;
for my $plugin (@plugins) {
my $tasks = $plugin->background_tasks;