View | Details | Raw Unified | Return to bug 37893
Collapse All | Expand All

(-)a/installer/data/mysql/db_revs/250600035.pl (+6 lines)
Lines 243-248 return { Link Here
243
        }
243
        }
244
244
245
        my $SIPconfigFile = "/etc/koha/sites/$koha_instance/SIPconfig.xml";
245
        my $SIPconfigFile = "/etc/koha/sites/$koha_instance/SIPconfig.xml";
246
247
        unless ( -f $SIPconfigFile && -r $SIPconfigFile ) {
248
            say_warning( $out, "Skipping migration. SIP config file not found or unreadable" );
249
            return;
250
        }
251
246
        say_info( $out, "Reading SIPconfig.xml for $koha_instance located at $SIPconfigFile" );
252
        say_info( $out, "Reading SIPconfig.xml for $koha_instance located at $SIPconfigFile" );
247
        my $SIPconfig = C4::SIP::Sip::Configuration->new($SIPconfigFile);
253
        my $SIPconfig = C4::SIP::Sip::Configuration->new($SIPconfigFile);
248
254
(-)a/t/db_dependent/Koha/SIP2/SIP2ModuleMigration.t (-2 / +31 lines)
Lines 17-24 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 3;
20
use Test::More tests => 4;
21
use Test::NoWarnings;
21
use Test::NoWarnings;
22
use Test::MockModule;
22
23
23
use t::lib::TestBuilder;
24
use t::lib::TestBuilder;
24
25
Lines 175-177 subtest 'config_timestamp is updated when database configuration changes' => sub Link Here
175
176
176
    $schema->storage->txn_rollback;
177
    $schema->storage->txn_rollback;
177
};
178
};
178
- 
179
180
subtest 'Atomicupdate skips migrating data if provided config file doesn\'t exist or is unreadable' => sub {
181
182
    plan tests => 1;
183
184
    my $captured_message;
185
    my $mock = Test::MockModule->new('Koha::Installer::Output');
186
    $mock->mock(
187
        'say_warning',
188
        sub {
189
            my ( $out_object, $message ) = @_;
190
            $captured_message = $message;
191
        }
192
    );
193
194
    my $koha_instance    = $ENV{KOHA_CONF} =~ m!^.+/sites/([^/]+)/koha-conf\.xml$! ? $1 : undef;
195
    my $SIPconfigXMLFile = "/etc/koha/sites/$koha_instance/SIPconfig.xml";
196
    my $fileSIPconfig    = C4::SIP::Sip::Configuration->new($SIPconfigXMLFile);
197
198
    rename $SIPconfigXMLFile, "/etc/koha/sites/$koha_instance/IDontExist.xml";
199
    my $db_rev_file = C4::Context->config('intranetdir') . '/installer/data/mysql/db_revs/250600035.pl';
200
    C4::Installer::run_db_rev($db_rev_file);
201
    is(
202
        $captured_message,
203
        "Skipping migration. SIP config file not found or unreadable",
204
        'say_warning received the correct migration skip message'
205
    );
206
    rename "/etc/koha/sites/$koha_instance/IDontExist.xml", $SIPconfigXMLFile;
207
    }

Return to bug 37893