You are here

function drupal_ftp_delete_file in Backup and Migrate 8.3

Same name and namespace in other branches
  1. 8.2 includes/destinations.ftp.inc \drupal_ftp_delete_file()
  2. 6.3 includes/destinations.ftp.inc \drupal_ftp_delete_file()
  3. 6.2 includes/destinations.ftp.inc \drupal_ftp_delete_file()
  4. 7.3 includes/destinations.ftp.inc \drupal_ftp_delete_file()
  5. 7.2 includes/destinations.ftp.inc \drupal_ftp_delete_file()

The drupal_ftp_delete_file Function This function attempts to delete a file called $filename from the FTP server.

1 call to drupal_ftp_delete_file()
backup_migrate_destination_ftp::_delete_file in includes/destinations.ftp.inc
Delete from the ftp destination.

File

includes/destinations.ftp.inc, line 359
Functions to handle the FTP backup destination.

Code

function drupal_ftp_delete_file($filename, &$ftp) {

  // Remove the specified file from the FTP server
  if (!@drupal_ftp_connect($ftp)) {
    return FALSE;
  }
  $delete_result = @ftp_delete($ftp->__conn, $filename);
  if ($delete_result == TRUE) {

    // The file/folder was renamed successfully
    return TRUE;
  }
  else {

    // Couldn't delete the selected file
    _backup_migrate_message('FTP Error: Couldn\'t delete the selected file: @filename', array(
      '@filename' => $filename,
    ), 'error');
    return FALSE;
  }
}