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

(-)a/Koha/File/Transport.pm (+13 lines)
Lines 264-269 sub rename_file { Link Here
264
    die "Subclass must implement rename_file";
264
    die "Subclass must implement rename_file";
265
}
265
}
266
266
267
=head3 disconnect
268
269
    $transport->disconnect();
270
271
Method for disconnecting from the current file server
272
273
=cut
274
275
sub disconnect {
276
    my ($self) = @_;
277
    die "Subclass must implement disconnect";
278
}
279
267
=head3 _post_store_trigger
280
=head3 _post_store_trigger
268
281
269
    $server->_post_store_trigger;
282
    $server->_post_store_trigger;
(-)a/Koha/File/Transport/FTP.pm (+34 lines)
Lines 188-193 sub rename_file { Link Here
188
    return 1;
188
    return 1;
189
}
189
}
190
190
191
=head3 disconnect
192
193
    $server->disconnect();
194
195
Disconnects from the FTP server.
196
197
=cut
198
199
sub disconnect {
200
    my ($self) = @_;
201
202
    if ( $self->{connection} ) {
203
        $self->{connection}->quit;
204
        $self->{connection} = undef;
205
    }
206
207
    return 1;
208
}
209
191
sub _abort_operation {
210
sub _abort_operation {
192
    my ( $self, $message ) = @_;
211
    my ( $self, $message ) = @_;
193
212
Lines 206-209 sub _abort_operation { Link Here
206
    return;
225
    return;
207
}
226
}
208
227
228
=head3 DESTROY
229
230
Ensure proper cleanup of FTP connections
231
232
=cut
233
234
sub DESTROY {
235
    my ($self) = @_;
236
237
    # Clean up the FTP connection
238
    if ( $self->{connection} ) {
239
        $self->{connection}->quit;
240
    }
241
}
242
209
1;
243
1;
(-)a/Koha/File/Transport/Local.pm (+15 lines)
Lines 379-382 sub rename_file { Link Here
379
    return 1;
379
    return 1;
380
}
380
}
381
381
382
=head3 disconnect
383
384
    $server->disconnect();
385
386
For local transport, this is a no-op as there are no connections to close.
387
388
=cut
389
390
sub disconnect {
391
    my ($self) = @_;
392
393
    # No-op for local transport
394
    return 1;
395
}
396
382
1;
397
1;
(-)a/Koha/File/Transport/SFTP.pm (-1 / +24 lines)
Lines 231-236 sub rename_file { Link Here
231
    return 1;
231
    return 1;
232
}
232
}
233
233
234
=head3 disconnect
235
236
    $server->disconnect();
237
238
Disconnects from the SFTP server.
239
240
=cut
241
242
sub disconnect {
243
    my ($self) = @_;
244
245
    if ( $self->{connection} ) {
246
        $self->{connection}->disconnect;
247
        $self->{connection} = undef;
248
    }
249
250
    return 1;
251
}
252
234
=head2 Internal methods
253
=head2 Internal methods
235
254
236
=head3 _post_store_trigger
255
=head3 _post_store_trigger
Lines 355-360 Ensure proper cleanup of open filehandles Link Here
355
sub DESTROY {
374
sub DESTROY {
356
    my ($self) = @_;
375
    my ($self) = @_;
357
376
377
    # Clean up the SFTP connection
378
    if ( $self->{connection} ) {
379
        $self->{connection}->disconnect;
380
    }
381
358
    # Ensure the filehandle is closed properly
382
    # Ensure the filehandle is closed properly
359
    if ( $self->{stderr_fh} ) {
383
    if ( $self->{stderr_fh} ) {
360
        close $self->{stderr_fh} or warn "Failed to close STDERR filehandle: $!";
384
        close $self->{stderr_fh} or warn "Failed to close STDERR filehandle: $!";
361
- 

Return to bug 38489