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

--- Comment #4 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 207009
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207009&action=edit
Bug 43666: Opt Koha::File::Transports into pluggable STI registration

Switches Koha::File::Transports from ::SingleTableInheritance to
::Pluggable, so a permitted, enabled plugin can register additional
file transport backends (e.g. WebDAV) without a core patch. With the
kill-switch off and no plugin permitted, behaviour is unchanged -
confirmed by the full existing File::Transport suite passing
unmodified.

store()'s post-store re-dispatch used a separate, hardcoded sftp/ftp/
local map rather than the real STI dispatch - a plugin-contributed
transport stored through it would silently re-bless to the generic
base class instead of its own subclass. Now resolves via
Koha::File::Transports->_sti_object_class($self), the same mechanism
find()/search() use.

Test plan:
1. Apply the patches and restart_all.
2. Confirm Administration > File transports behaves identically to
   before this patch, with everything left at its defaults (no visible
   change is the expected result at this step).
3. prove t/db_dependent/Koha/File/Transport.t - confirm the "Test
   store() re-blesses via the STI dispatch map" subtest passes,
   verifying store() returns the correct subclass instance for sftp,
   ftp, local, and an unrecognized transport value.
4. Set <enable_plugin_sti_registration>1</enable_plugin_sti_registration>
   in koha-conf.xml, restart_all.
5. Install and enable a plugin implementing additional_sti_classes for
   Koha::File::Transports (e.g. a companion WebDAV transport plugin,
   linked from this bug's comments).
6. In the Plugin management UI's actions menu for that plugin, confirm
   a "Allow registering classes for Koha::File::Transports" option
   appears, and toggle it on.
7. Go to Administration > File transports, create a new file transport
   using the plugin-contributed transport type, and confirm it
   dispatches to the plugin's class (e.g. via a real or local test
   endpoint for that transport).
8. Toggle the permission back off in the Plugin management UI. Confirm
   the plugin-contributed transport type is no longer offered when
   creating a new file transport, and any already-created row of that
   type falls back to generic Koha::File::Transport behaviour rather
   than erroring.
9. Set <enable_plugin_sti_registration>0</enable_plugin_sti_registration>
   again. Confirm re-toggling permission on in the Plugin management UI
   has no effect while the kill-switch is off.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to