function drupal_ftp_create_directory in Backup and Migrate 8.3
Same name and namespace in other branches
- 8.2 includes/destinations.ftp.inc \drupal_ftp_create_directory()
- 6.3 includes/destinations.ftp.inc \drupal_ftp_create_directory()
- 6.2 includes/destinations.ftp.inc \drupal_ftp_create_directory()
- 7.3 includes/destinations.ftp.inc \drupal_ftp_create_directory()
- 7.2 includes/destinations.ftp.inc \drupal_ftp_create_directory()
The drupal_ftp_create_directory Function This function tries to make a new directory called $folder_name on the FTP server. If it can create the folder, then the folder is given appropriate rights with the CHMOD command.
File
- includes/
destinations.ftp.inc, line 328 - Functions to handle the FTP backup destination.
Code
function drupal_ftp_create_directory($folder_name, &$ftp) {
// Makes a new folder on the web server via FTP
if (!@drupal_ftp_connect($ftp)) {
return FALSE;
}
$create_result = @ftp_mkdir($ftp->__conn, $folder_name);
if ($create_result == TRUE) {
// Can we change the files permissions?
$exec_result = @ftp_site($ftp->__conn, 'chmod 0777 ' . $folder_name . '/');
if ($exec_result == TRUE) {
return TRUE;
}
else {
_backup_migrate_message('FTP Error: Couldn\'t set owner permissions on @folder.', array(
'@folder',
$folder_name,
), 'error');
return FALSE;
}
}
else {
_backup_migrate_message('FTP Error: Couldn\'t create new folder @folder.', array(
'@folder',
$folder_name,
), 'error');
return FALSE;
}
}