Bugzilla – Attachment 163000 Details for
Bug 19605
ILL backends should be pluggable through regular Koha plugins
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19605: Rename method and use the instantiated plugin in the call
Bug-19605-Rename-method-and-use-the-instantiated-p.patch (text/plain), 2.34 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-03-09 13:07:19 UTC
(
hide
)
Description:
Bug 19605: Rename method and use the instantiated plugin in the call
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-03-09 13:07:19 UTC
Size:
2.34 KB
patch
obsolete
>From 2c29c6d54c687fdc337648aa5f73ebcd1e8412e2 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Sat, 9 Mar 2024 09:47:45 -0300 >Subject: [PATCH] Bug 19605: Rename method and use the instantiated plugin in > the call > >This patch makes the backend instantiation happen through a plugin >object method instead of a static one. This way, the (already) >instantiated plugin can be reused (if needed) in the plugin workflow >like this: > >sub new_il_backend { > my ($self, $params) = @_; > return Custom::Backend->new( > { > config => $params->{config}, > logger => $params->{logger}, > plugin => $self, > } > ); >} > >The passed plugin object would then be used to retrieve whatever >plugin-defined configurations, template paths or even helper methods. On >INN-Reach, it gives the backend access to API user agents, task queue >injection, etc. > >This patch also renames the method so it is more straight-forward this is >related to ILL. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Illrequest.pm | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > >diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm >index 600cfe53b5e..7527d239696 100644 >--- a/Koha/Illrequest.pm >+++ b/Koha/Illrequest.pm >@@ -435,13 +435,11 @@ sub load_backend { > "An invalid backend ID was requested ('')"); > } > >+ # Find plugin implementing the backend for the request > my $backend_plugin = $self->get_backend_plugin($backend_name); > if ($backend_plugin) { > >- # New way of loading backends: Through plugins >- my $backend_plugin_class = $backend_plugin->{class}; >- >- $self->{_my_backend} = $backend_plugin_class->new_backend( >+ $self->{_my_backend} = $backend_plugin->new_ill_backend( > { > config => $self->_config, > logger => Koha::Illrequest::Logger->new >@@ -449,7 +447,7 @@ sub load_backend { > ); > } elsif ($backend_name) { > >- # Old way of loading backends: Through backend_dir config >+ # Fallback to loading through backend_dir config > my @raw = qw/Koha Illbackends/; # Base Path > my $location = join "/", @raw, $backend_name, "Base.pm"; # File to load > my $backend_class = join "::", @raw, $backend_name, "Base"; # Package name >-- >2.44.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19605
:
158068
|
158069
|
158070
|
160433
|
160434
|
160435
|
162996
|
162997
|
162998
|
162999
|
163000
|
163001
|
163002
|
163003
|
163004
|
163005
|
163006
|
163007
|
163846
|
164084
|
164085
|
164086
|
164087
|
164088
|
164089
|
164090
|
164091
|
165201