Koha-clms/Koha/Template/Plugin
Tomás Cohen Arazi 35fd016f88
Bug 37711: (follow-up) Fix AuthClient plugin database upgrade handling
The AuthClient template plugin was causing 500 errors during database
upgrades when the identity_providers schema was out of sync. The plugin
tried to query the new 'auto_register_opac' column before the database
schema was updated, creating a chicken-egg problem.

This patch wraps the database query in Try::Tiny to handle schema
mismatches gracefully during upgrades, allowing the upgrade process
to continue without crashing the authentication interface.

Test plan:
1. On main, apply all bug 37711 patches BUT THIS ONE
2. Simulate an upgrade by:

* Edit Koha.pm so it points to the next version
* Move the atomicupdate file to the right number in db_revs

3. Restart everything:
   $ ktd --shell
  k$ restart_all
4. Access http://kohadev-intra.localhost
=> FAIL: You get a 500! With a stack trace!
5. Apply this patch
6. Repeat 3 and 4
=> SUCCESS: No 500 error, redirects to installer
7. Proceed with the upgrade:
=> SUCCESS: It works as it should
8. Run tests:
  k$ prove -v t/db_dependent/Template/Plugin/AuthClient.t
=> SUCCESS: All tests pass
9. Sign off :-D

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-05 07:12:33 -07:00
..
AdditionalContents.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Asset.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
AudioAlerts.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
AuthClient.pm Bug 37711: (follow-up) Fix AuthClient plugin database upgrade handling 2025-11-05 07:12:33 -07:00
AuthorisedValues.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Biblio.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Branches.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Categories.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
CirculationRules.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
ClassSources.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Context.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Desks.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
ExtendedAttributeTypes.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Frameworks.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
HtmlId.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
HtmlScrubber.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
HtmlTags.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
I18N.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Item.pm Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
ItemTypes.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
JSConsents.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Koha.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
KohaDates.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
KohaPlugins.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
KohaSpan.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
KohaTimes.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Languages.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
NoticeTemplates.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Notices.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Price.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Registers.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Remove_MARC_punctuation.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
SafeURL.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
TablesSettings.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
To.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
raw.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00