2
0
forked from Wavyzz/dolibarr

init function

This commit is contained in:
Anthony Berton
2022-08-03 17:04:34 +02:00
parent ffecf42808
commit e511291228

View File

@@ -246,3 +246,33 @@ function dol_ftp_rmdir($connect_id, $file, $newsection)
return @ftp_rmdir($connect_id, $newremotefileiso);
}
}
/**
* Remove FTP directory
*
* @param resource $connect_id Connection handler
* @param string $newdir Dir create
* @param string $newsection $newsection
* @return result
*/
function dol_ftp_mkdir($connect_id, $newdir, $newsection)
{
global $conf;
if (!empty($conf->global->FTP_CONNECT_WITH_SFTP)) {
$newsection = ssh2_sftp_realpath($connect_id, ".").'/./'; // workaround for bug https://bugs.php.net/bug.php?id=64169
}
// Remote file
$filename = $file;
$remotefile = $newsection.(preg_match('@[\\\/]$@', $newsection) ? '' : '/').$file;
$newremotefileiso = utf8_decode($remotefile);
if (!empty($conf->global->FTP_CONNECT_WITH_SFTP)) {
return ssh2_sftp_mkdir($connect_id, $newremotefileiso);
} else {
return @ftp_mkdir($connect_id, $newremotefileiso);
}
}