Handle ftp_chdir error

This commit is contained in:
MDW 2024-03-15 18:36:54 +01:00
parent 1877dda1a4
commit c8db19331b
No known key found for this signature in database
2 changed files with 7 additions and 4 deletions

View file

@ -89,18 +89,20 @@ function dol_ftp_connect($ftp_server, $ftp_port, $ftp_user, $ftp_password, $sect
}
} else {
if (ftp_login($connect_id, $ftp_user, $ftp_password)) {
// Turn on passive mode transfers (must be after a successful login
// Turn on passive mode transfers (must be after a successful login)
if ($ftp_passive) {
ftp_pasv($connect_id, true);
}
// Change the dir
$newsectioniso = mb_convert_encoding($section, 'ISO-8859-1');
ftp_chdir($connect_id, $newsectioniso);
if (!ftp_chdir($connect_id, $newsectioniso)) {
$ok = 0;
$mesg = $langs->transnoentitiesnoconv("FailedToChdirOnFTPServer");
}
} else {
$mesg = $langs->transnoentitiesnoconv("FailedToConnectToFTPServerWithCredentials");
$ok = 0;
$error++;
$mesg = $langs->transnoentitiesnoconv("FailedToConnectToFTPServerWithCredentials");
}
}
}

View file

@ -327,6 +327,7 @@ SetupOfFTPClientModuleNotComplete=The setup of the FTP or SFTP client module see
FTPFeatureNotSupportedByYourPHP=Your PHP does not support FTP or SFTP functions
FailedToConnectToFTPServer=Failed to connect to server (server %s, port %s)
FailedToConnectToFTPServerWithCredentials=Failed to login to server with defined login/password
FailedToChdirOnFTPServer=Failed to change directory on the FTP server
FTPFailedToRemoveFile=Failed to remove file <b>%s</b>.
FTPFailedToRemoveDir=Failed to remove directory <b>%s</b>: check permissions and that the directory is empty.
FTPPassiveMode=Passive mode