Bug 14012 - Koha::FTP, a happy FTP-library to supercharge FTP operations.
Summary: Koha::FTP, a happy FTP-library to supercharge FTP operations.
Status: In Discussion
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Olli-Antti Kivilahti
QA Contact: Testopia
URL:
Keywords:
Depends on: 13995
Blocks:
  Show dependency treegraph
 
Reported: 2015-04-19 14:46 UTC by Olli-Antti Kivilahti
Modified: 2022-12-06 02:46 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 14012 - Koha::FTP, a happy FTP-library to supercharge FTP operations. (7.57 KB, patch)
2015-04-19 14:48 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Olli-Antti Kivilahti 2015-04-19 14:46:37 UTC
When dealing with FTP-connections, we need to prepare for all kinds of remote connection failures.
This library simply wraps exception handling and connection creation into a one nice package.
Comment 1 Olli-Antti Kivilahti 2015-04-19 14:48:42 UTC
Created attachment 38132 [details] [review]
Bug 14012 - Koha::FTP, a happy FTP-library to supercharge FTP operations.

    try {
        my $ftp = Koha::FTP->new( Net::FTP->new() );

        my $currentDir = $ftp->getCurrentFtpDirectory();
        $ftp->changeFtpDirectory($targetDirectory, $ftp);
        $ftp->putFtpFile($filePath, $ftp);
        $ftp->changeFtpDirectory($currentDir, $ftp);
        $ftp->deleteFtpFile($fileName, $ftp);
    catch {
        if (blessed($_) && $_->isa('Koha::Exception::ConnectionFailed')) {
            warn $_->error()."\n";
        }
    }
Comment 2 David Cook 2022-12-06 02:46:11 UTC
I'm not sure that this is really necessary, although adding Net::FTP as a dependency could be useful. 

Maybe Koha::FTP plus a CLI tool? 

I do FTP files from Koha instances so it could be handy to have this built-in