Bugzilla – Attachment 189908 Details for
Bug 37893
Migrate some SIP configuration into the staff interface
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37893: Handle SIPconfig.xml not found / unreadable
Bug-37893-Handle-SIPconfigxml-not-found--unreadabl.patch (text/plain), 2.86 KB, created by
Pedro Amorim
on 2025-11-24 11:41:01 UTC
(
hide
)
Description:
Bug 37893: Handle SIPconfig.xml not found / unreadable
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-11-24 11:41:01 UTC
Size:
2.86 KB
patch
obsolete
>From f74034a45f93529ac97d3152d36181e357f9aee0 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Mon, 24 Nov 2025 11:39:45 +0000 >Subject: [PATCH] Bug 37893: Handle SIPconfig.xml not found / unreadable > >prove t/db_dependent/Koha/SIP2/SIP2ModuleMigration.t >--- > installer/data/mysql/db_revs/250600035.pl | 6 ++++ > .../Koha/SIP2/SIP2ModuleMigration.t | 32 ++++++++++++++++++- > 2 files changed, 37 insertions(+), 1 deletion(-) > >diff --git a/installer/data/mysql/db_revs/250600035.pl b/installer/data/mysql/db_revs/250600035.pl >index 0b440ca0dcc..dc85431b324 100755 >--- a/installer/data/mysql/db_revs/250600035.pl >+++ b/installer/data/mysql/db_revs/250600035.pl >@@ -243,6 +243,12 @@ return { > } > > my $SIPconfigFile = "/etc/koha/sites/$koha_instance/SIPconfig.xml"; >+ >+ unless ( -f $SIPconfigFile && -r $SIPconfigFile ) { >+ say_warning( $out, "Skipping migration. SIP config file not found or unreadable" ); >+ return; >+ } >+ > say_info( $out, "Reading SIPconfig.xml for $koha_instance located at $SIPconfigFile" ); > my $SIPconfig = C4::SIP::Sip::Configuration->new($SIPconfigFile); > >diff --git a/t/db_dependent/Koha/SIP2/SIP2ModuleMigration.t b/t/db_dependent/Koha/SIP2/SIP2ModuleMigration.t >index 00a76ee33d6..f0e8fc3f39c 100755 >--- a/t/db_dependent/Koha/SIP2/SIP2ModuleMigration.t >+++ b/t/db_dependent/Koha/SIP2/SIP2ModuleMigration.t >@@ -17,8 +17,9 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > use Test::NoWarnings; >+use Test::MockModule; > > use t::lib::TestBuilder; > >@@ -175,3 +176,32 @@ subtest 'config_timestamp is updated when database configuration changes' => sub > > $schema->storage->txn_rollback; > }; >+ >+subtest 'Atomicupdate skips migrating data if provided config file doesn\'t exist or is unreadable' => sub { >+ >+ plan tests => 1; >+ >+ my $captured_message; >+ my $mock = Test::MockModule->new('Koha::Installer::Output'); >+ $mock->mock( >+ 'say_warning', >+ sub { >+ my ( $out_object, $message ) = @_; >+ $captured_message = $message; >+ } >+ ); >+ >+ my $koha_instance = $ENV{KOHA_CONF} =~ m!^.+/sites/([^/]+)/koha-conf\.xml$! ? $1 : undef; >+ my $SIPconfigXMLFile = "/etc/koha/sites/$koha_instance/SIPconfig.xml"; >+ my $fileSIPconfig = C4::SIP::Sip::Configuration->new($SIPconfigXMLFile); >+ >+ rename $SIPconfigXMLFile, "/etc/koha/sites/$koha_instance/IDontExist.xml"; >+ my $db_rev_file = C4::Context->config('intranetdir') . '/installer/data/mysql/db_revs/250600035.pl'; >+ C4::Installer::run_db_rev($db_rev_file); >+ is( >+ $captured_message, >+ "Skipping migration. SIP config file not found or unreadable", >+ 'say_warning received the correct migration skip message' >+ ); >+ rename "/etc/koha/sites/$koha_instance/IDontExist.xml", $SIPconfigXMLFile; >+ } >-- >2.39.5
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 37893
:
172530
|
172584
|
188721
|
189711
|
189712
| 189908